PDA

View Full Version : Handle specific URL with QHttp



guilugi
8th April 2006, 11:49
Hello there !

I use Videolan to record some streaming channels, and I have designed a Qt application
to program those records...with a time to start & a time to stop.

So, each time I have a new record to start, I launch a vlc through a QProcess, and it works great.

My problem is the shutdown...basically, I have 2 options :
- dirty : I kill the QProcess (and vlc then)
- cool : I send an http request to vlc, to order him to shutdown properly.

The URL is this one : "http://127.0.0.1/admin/?control=shutdown"
But, the admin section requires a login : pass (admin:admin).

So, I have to login before sending this url...and I'd like to do it with QHttp.

I tried this "http://admin:admin@127.0.0.1/admin/?control=shutdown", but I feel it's not the good way.

Any idea ?

Thanks in advance,
Guilugi.

wysota
8th April 2006, 22:39
Sure :) Take a look at QHttp::setUser(). If that's not enough for you, you can use QHttpRequestHeader to set a custom header of your choice.

guilugi
9th April 2006, 14:05
Thanks Wysota for your answer !

I found another way, very simple, and clean :)
I enabled a TCP interface on vlc, and I connect to it with a QTcpSocket...
All I have to do is write "quit\n", and vlc shutdowns perfectly.

But, I'll try your method.

Thanks again,
Guilugi.