Windows – Using telnet under windows to test HTTP

httptelnetwindows 7

I'm learning http, and trying to use telnet to send my own http requests.

In the command prompt, I entered:

telnet 80

The screen is cleared and I see a blinking cursor.
1. Why don't I see any indication that I'm connected?

Now, trying to type an http command (get index.html…)
I see the cursor moving to the right as I type, but I don't see the letters appear on the screen. Only blanks.
2. Why is that?

(Using windows7 64 bit)

Best Answer

HTTP is not based on the telnet protocol. There's actually a few things wrong with using telnet as a basis for "testing" a HTTP server. First, telnet sends some extra bytes immediately after establishing a TCP connection to setup the session parameters. Second, HTTP does not echo data sent by the remote peer. Third, good IPS devices can drop connections to the HTTP port when that initial session data is sent, or when protocol violations are encountered.

Using the telnet client to test a HTTP server is hack-ish at best. The client will display a blank-screen when the TCP session is established, and will only display what the server sends back. If you're clever, you might be able to retrieve a page on many servers... but I would consider it bad-practice. Read up on the HTTP protocol on how to format a GET request.

A basic http request is done as follows:

GET / HTTP/1.0

Note the extra line after the request. A complete request ends with a blank newline.