9 February 2017

How to test an HTTP (WWW) server by using telnet

What you need

  • The URI (i.e. the ‘address’) of the web resource you wish to test
    • Use the host name in the telnet command and the Host: header
    • Use the path, if any, in the HEAD request

What to do

To retrieve the document as well as the headers, use GET instead of HEAD.

If you want the root document, use GET / HTTP/1.1 (or HEAD / HTTP/1.1).

The initial telnet: > symbolises your shell prompt.

telnet: > telnet www.example.com http
telnet: Trying 192.0.2.2...
telnet: Connected to www.example.com.
telnet: Escape character is '^]'.
client: HEAD /example/example.shtml HTTP/1.1
client: Host: www.example.com
client: Connection: close
client: 
server: HTTP/1.1 200 OK
server: Date: Sat, 21 Jan 2017 22:13:05 GMT
server: Server: Apache/1.3.12-Turbo
server: Connection: close
server: Content-Type: text/html