HOWTO: using telnet to make HTTP request
Telnet is an old utility used in local network to offer a bidirectional communication text-oriented using a terminal. Can be used also to make an http call to a remote server with the purpose of testing. Let’s see how:
- Open you favorite terminal
- Type (instead of diegor.it you can choose whatever server you want)
#> telnet diegor.it 80
and you should have as output:
Trying 75.119.192.123... Connected to diegor.it. Escape character is '^]'.
- Now type:
GET / HTTP/1.1 host: diegor.it <line feed>
where “/” is the remote path. In this case we want the root. The output looks like this below:
HTTP/1.1 200 OK Date: Mon, 13 Jun 2011 09:06:43 GMT Server: Apache Cache-Control: no-cache, must-revalidate, max-age=0 Pragma: no-cache Expires: Wed, 11 Jan 1984 05:00:00 GMT Last-Modified: Sun, 12 Jun 2011 13:29:48 GMT Vary: Accept-Encoding Content-Length: 85589 Content-Type: text/html;charset=UTF-8 ...
Pretty simple! Any questions or comments are welcome.



Paolo Bernardi 12:17 pm on June 13, 2011 Permalink |
Careful there, maybe that MaxOS X telnet is very smart, but usually the command is in the form “telnet hostname port”. So, ‘telnet http://www.diegor.it 80′ is a better way to do this, the protocol is specified by the port number.
diegor 12:29 pm on June 13, 2011 Permalink |
I can’t get what are you saying. Where’s the “error”?
diegor 12:32 pm on June 13, 2011 Permalink |
Ok, now i get it. The problem is that this fucking wordpress put “http://” as prefix in www addresses
Paolo Bernardi 2:32 pm on June 13, 2011 Permalink |
Hahahaha OK, that’s a sound explaination.
Paolo Bernardi 2:32 pm on June 13, 2011 Permalink |
Besides, WP has put an http:// also in front of my comment’s telnet string
))
diegor 3:14 pm on June 13, 2011 Permalink
Yes, I saw that! fucking WP