This guide goes over how telnet can be used to send both GET and HEAD http requests. These commands can be useful when debugging a website for example finding out whether it supports caching or if the content is being encoded by gzip.
Before we are able to enter any telnet commands we first need to start a telnet session by starting it in a terminal.
Command: ‘telnet
‘
Now that we started telnet we are now able to pass a command in order to connect.
Command: ‘o example.com 80
‘
In the command above replace example.com with the website that you would like to connect to.
Response code / message: Trying #.#.#.#… > connected to example.com
As we are now connected to the web server we can start passing commands to it. In this example the two commands that will be used are:
Other requests types can also be made, for more information visit the specification page. The first command set is a HEAD request.
Command: ‘HEAD /index.html HTTP/1.1
‘
Command: ‘Host: example.com
‘
After entering the second command press enter / return again.
Response code / message: HTTP/1.1 200 OK
The other command set that can be run is GET which is similar to the last.
Command: ‘GET /index.html HTTP/1.1
‘
Command: ‘Host: example.com
‘
After entering the second command press enter / return again.
Response code / message: HTTP/1.1 200 OK
HEAD:
GET: