Showing posts with label http. Show all posts
Showing posts with label http. Show all posts

Tuesday, 8 September 2009

Testing HTTP using Telnet

While this is commonplace knowledge, I find myself googling for it every time I need to test HTTP connectivity and responses with telnet. Telnet provides a quick and dirty means to put back data over HTTP and to test the response headers.

Firstly, fire up telnet with the hostname and port for the HTTP connection:
telnet www.somesite.com 80
If it can connect to the server, then you will be presented with:

Trying www.somesite.com...
Connected to www.somesite.com.
Escape character is '^]'.

Now type the following to request index.html over HTTP:

GET /index.html HTTP/1.1
host: www.somesite.com

This will then return the header information, followed by the actual data.