-1

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"
Jonah Fleming
  • 1,187
  • 4
  • 19
  • 31
  • 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 Dec 17 '16 at 07:43
  • Thanks, @SteffenUllrich your right, I do get the header anyway but just wondered why I was getting it. – Jonah Fleming Dec 17 '16 at 08:43

1 Answers1

0

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

Armali
  • 18,255
  • 14
  • 57
  • 171