Thursday, February 16, 2012

Web server request and response via telnet

How to see web server response via telnet command.

As you know, most of network connection you can see via telnet.
Mail server, Web server, FTP server so on.

Now, I will show you how to access WEB Server via telnet.
There are many tool to see it better.
But, when you need only for simple reason to check, telnet is the good option to check.

telnet www.google.com 80
GET / HTTP/1.0
Host: www.google.com
'type enter 2 times'

When you are behind of proxy server. you should go through proxy. You need to telnet to your proxy server and connect.
Please see below example.
192.168.1.4 is the proxy server ip and 8080 is the port number
telnet 192.168.1.4 8080
CONNECT www.google.com:80 HTTP/1.0
'type enter 2 times'
GET / HTTP/1.0
Host: www.google.com
'type enter 2 times'

you can replace '/' character which is located after 'GET' to your demand like '/index.php', 'index.do' so on.
most of server use virtual host. so "Host" header is necessary to configure.
It should be basically same as host address with out any query string.

If you are interested more about header list
Please check this link
http://en.wikipedia.org/wiki/List_of_HTTP_header_fields

now, you can make your own script for regular check or application for performance test so on.

No comments:

Post a Comment