5

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

In the command prompt, I entered:

telnet google.com 80

Result: 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)

1
  • Whoever voted down this question, you are welcome to explain in the comments what you found wrong about it.
    – gidireich
    Nov 1, 2012 at 16:37

2 Answers 2

3

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.

5
  • So, what application would you use to build and send your own http requests? (as means of learning the protocol)
    – gidireich
    Nov 1, 2012 at 16:35
  • I use putty personally. Make sure the connection type is set to RAW, and the Local echo is forced to "on". For more advanced stuff... I just crack it open in my web-browser and use the debugger-tools built into chrome.
    – TheCompWiz
    Nov 1, 2012 at 16:37
  • How is putty different from windows telnet in the regard that you mentioned? "telnet sends some extra bytes immediately after establishing a TCP connection to setup the session parameters"
    – gidireich
    Nov 1, 2012 at 16:42
  • Putty using a "raw" connection type just establishes a RAW TCP connection without the initial telnet garbage.
    – TheCompWiz
    Nov 1, 2012 at 16:46
  • Oh, I think I see. The "raw" mode. I wasn't actually aware that telnet is different from this RAW.
    – gidireich
    Nov 1, 2012 at 16:46
1

Why don't I see any indication that I'm connected?

Why would the server send extra unneeded data and use more bandwidth? However you are connected and you can test that.

Try entering HTTP/1.0 and press [enter]. You should get a response.
(One containing an error, but usually enough to test if the webserver is up and running.)

I see the cursor moving to the right as I type, but I don't see the letters appear on the screen. Only blanks.

This is due to windows telnet. It has local echo disabled by default.

You must log in to answer this question.