QTcpServer : retrieve the requested URL
Hi there!
I have developped a server, its address is 127.0.0.1:4242 ; I'm using QTcpServer, and QTcpSocket (to send the answer).
I would like to be able to know what is the requested URL. :(
For example, if I type this in Firefox :
Code:
http://127.0.0.1:4242/directory1/test/
how can I know that firefox wants to access /directory/test/ ?
I tried localAddress(), but it only returns 127.0.0.1
I really need your help guys ! :(
Re: QTcpServer : retrieve the requested URL
Hi there!
You need a HTTP-Server for that.
Have a look at: http://doc.trolltech.com/solutions/4...le-server.html
HIH
Johannes
Re: QTcpServer : retrieve the requested URL
Thank you but I can't figure out what is the function that gives the requested address in your example :confused:
Re: QTcpServer : retrieve the requested URL
Well.. you need to parse the get command..
http://en.wikipedia.org/wiki/Hyperte...xample_session
Code:
if (tokens[0] == "GET") {
tokens[1] should be the requested url.
Sorry for not having pointed that out .. Maybe you just need to search for a more complete HTTP Server using google?
Johannes
Re: QTcpServer : retrieve the requested URL
Perfect !
Thank you very much ! :cool: