PDA

View Full Version : How exactly to use proxy in socket?



Passerby
3rd July 2009, 05:04
For some reason I have to use plain QTcpSockets to send and receive HTTP headers in plain texts. In direct connection environment it works well. But I'm not quite sure how to use proxy in this case.

From what I know, if a direct HTTP header is

GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: whatever
Host: www.example.com
Connection: Keep-Alive
, then the proxi-ed HTTP header should be

GET http://www.example.com/ HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
User-Agent: whatever
Host: www.example.com
Proxy-Connection: Keep-Alive <----------IE

So which one should I choose to send, if my QTcpSocket is used with QAbstractSocket::setProxy()?

Many thanks.

Passerby
3rd July 2009, 09:24
Or I should just connect to the proxy server as a direct connection and send the proxi-ed HTTP header (since the proxy server is a HTTP Proxy)?