What, at the bare minimum, is required for an HTTP request?
http
Solution
It must use CRLF line endings, and it must end in `\r\n\r\n`, i.e. a blank line. This is what I use:
printf 'GET / HTTP/1.1\r\nHost: www.example.com\r\nConnection: close\r\n\r\n' |
nc www.example.com 80
Additionally, I prefer `printf` over `echo`, and I add an extra header to have the server close the connection, but those aren’t needed.
Problem
I'm trying to issue a GET command to my local server using `netcat` by doing the following: ``` echo -e "GET / HTTP/1.1\nHost: localhost" | nc localhost 80 ``` Unfortunately, I get a `HTTP/1.1 400 Bad Request` response for this. What, at the very minimum, is required for a HTTP request?