GET works but telnet does not (HTTP GET)

httptelnet

I tried this from bash:

GET http://cetatenie.just.ro HTTP/1.1

It works fine, and I am able to get the page, then I try this from telnet:

telnet cetatenie.just.ro 80 
Trying 85.120.166.76...
Connected to cetatenie.just.ro.
Escape character is '^]'.
GET / HTTP/1.1
Host: cetatenie.just.ro

I get an Internal Server Error (Http Error Code 500)

The thing is, I do not really have access on the Server (it is an app deployed on IIS 7).
Why does performing a GET work and accessing it through telnet does not?

All I could think of was that I need to send some additional headers.
I tried using the Live Http Headers and sending the same thing that they do :

http://cetatenie.just.ro/

GET http://cetatenie.just.ro/ HTTP/1.1
Host: cetatenie.just.ro
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Proxy-Connection: keep-alive
Cookie: .ASPXANONYMOUS=Ij8RLazqzAEkAAAAMTk5ZjY0MGUtYWU0NC00ZmViLTgyNTgtMWU0MjNlM2IyZWEx0; language=en-US

But it still does not work with telnet.

Best Answer

The server (Server: Microsoft-IIS/7.5) needs also a HOST-header as well as the USER-AGENT-header, I tried this:

 telnet cetatenie.just.ro 80 
 Trying 85.120.166.76...
 Connected to cetatenie.just.ro.
 Escape character is '^]'.
 GET / HTTP/1.1
 HOST: cetatenie.just.ro
 USER-AGENT: Foobar

and it worked.

Related Question