I get 400 bad request from some websites but not others with HEAD request

438 views Asked by At

I am making a banner grabber and have finally ironed out the HEAD / HTTP/1.1 request according to the guidelines, but some websites still give me '400 Bad Request'

why is that?

Here is my request:

"HEAD / HTTP/1.1\r\nHost: target:port\r\nConnection: close\r\n\r\n"
1

There are 1 answers

0
Armali On

Should the Head: be Host: ? Apart from that, sites might block the HEAD request, i.e. there is no requirement that they must offer it. Also, the target you give in the Host header might not match a name setup on the server. Nevertheless you might get the servers banner (I.e. Server header I suppose) from the 400 response too, if the server sends such header at all (not required). – Steffen Ullrich