If you plan to use HTTP / 1.1 (more or less required if you go to a virtual host), your GET request must have a host name, either in the Host header or as an absolute URI in the query string (see RFC 2616 section 5.1.2 )
Your answer will also require Content-Length or pass the encoding headers and delimiters .
If you want to βsmashβ HTTP with a HEAD request, it looks like HTTP may not be the best protocol choice. You can also return something to the custom header, but this is not a clean way to do this.
Please note that even if you implement your own protocol, you will need to implement a mechanism similar to that provided by Content-Length or encoded coding to determine when to stop reading from the far side (otherwise you won "Unable to detect poorly closed connections. "
EDIT:
Here is a quick example, it will depend on your hostname (assuming HTTP 1.1). I think you could use OPTIONS . It depends on how ready you are to break HTTP ...
Request:
GET / HTTP/1.1 Host: www.example.com
This is 14 + 2 + 21 + 2 + 2 = 41 bytes (2 for CRLF)
Answer:
HTTP/1.1 200 OK Content-Length: 1 Content-Type: text/plain a
This is 15 + 2 + 17 + 2 + 24 + 2 + 2 + 1 = 65 bytes
For HTTPS there will be small overhead for the SSL / TLS channel itself, but the bulk of it will be taken by handshakes, in particular, the server certificate (provided that you do not use client-certificate authentication) should be the largest. Check the size (in DER format) of your certificate.
Bruno
source share