Quote Originally Posted by Huk View Post
however weird thing is that with some links it works OK (like the google link mentioned in the first post), but with others I get "Bad request", also I can do:

Qt Code:
  1. socket.write("GET /images/srpr/nav_logo73.png\r\n");
To copy to clipboard, switch view to plain text mode 

but not HEAD:

Qt Code:
  1. socket.write("HEAD /images/srpr/nav_logo73.png\r\n");
To copy to clipboard, switch view to plain text mode 

which gives me "Bad request".

I am not a networking expert (obviously ;] ) but I think the problem is that while browsers and QNetworkAccesManager sends GET, HEAD and other HTTP requests that they are somehow identified (by wireshark for example) as HTTP, and my requests are identified as TCP (wireshark informs me that my requests are "TCP segment of a reassembled PDU", when I look inside I can see my request), please correct me if I am wrong.

How can I fix that?
A correct GET or HEAD request looks like:
Qt Code:
  1. GET /images/srpr/nav_logo73.png HTTP/1.0\r\n
  2. HEAD /images/srpr/nav_logo73.png HTTP/1.1\r\n
To copy to clipboard, switch view to plain text mode 
(See http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html)
Some servers will accept malformed requests, some won't. If you are going to reinvent the wheel, try to make it round