How to send the GET method to test a HTTP server
These days I had the problem that I wasn't able to connect to a http server. The problem was the firewall. I wanted to test the connection through port 80 by sending a simple GET to the web server. So the first attempt was to do a
$ telnet $host 80
GET / HTTP/1.0
<Here the response should be served ... but>
But the Problem with this (at least on debian) was, that the
telnet client did not send a <CR><LF>
combination which is needed by the HTTP server. Neither toggling
the crlf option in the telnet client nor any known
keybord sequence like ^M, ^J,
enter, return, aso. did help. So what did
the trick?
$ echo -e -n "GET / HTTP/1.0\r\n\r\n" | nc $host 80
If you are interested in the HTTP protocol itself and the different methods I find the wikipedia to be a good starting point.