Forum Moderators: phranque
- Opened the Run dialog and entered 'cmd' to bring up a command prompt.
- Entered 'telnet example.com 80'
- then the screen goes blank and I can't see what I'm typing
- I type 'HEAD / HTTP/1.0' anyway (though I can't see it) and hit enter twice
- I get 'HTTP/1.1 400 Bad Request' followed by some HTML for the bad request error page.
what's going on, why can't I see what I'm typing? I have to use telnet for this (long story), any help would be appreciated.
On 9X versions of telnet you can do this via the menu, on the w2k you need to enter telnet and type "set localecho".
Personally for all my non-scripted raw-requests I prefer NetCatNT (there is an NT version as well as a *nix version) as its a lot simplier, gives more information and is more suited for the task you are attempting - plus you can feed it stuff via the command line pipe.
Personally I never really use the HEAD request as 99% of the time I like to get the page content as well as the headers. Typically with HTTP 1.0 you can get away with;
GET / HTTP/1.0
However if you want to try using the HTTP 1.1 protocol you need to add a little more - otherwise you can end up getting 400 errors and other such fun
GET / HTTP/1.1
Host: www.example.com
Connection: Close
Potentially one reason for you getting 400 errors is that you are trying to query a site which is on a virtual host without supplying a HOST: header, in effect not telling the virtual host which site you are interested in...
- Tony
when do I type 'set localecho'?
whenever I do it I get the 400 Bad Request error?
What on earth am I doing wrong?
GET / HTTP/1.1
Host: www.example.com
Connection: Close
How do I type in three lines without 'firing' the first one when I press enter?
To be honest you find this problem with a lot of raw request tools - they either send data with every keystroke or when you press return. Often the way around this is to copy and paste multi-line data into the window...
However that said HTTP requests do allow multi-line input, ie
GET / HTTP/1.1<rtn>
HOST: example.com<rtn>
CONNECTION: Close<rtn>
<rtn>
<rtn>
With the double return terminating the input portion of the request and telling the server to process what it has been given so far...
Where do you type set localecho?
1) Start telnet but don't use any parameters to force it to enter the command line mode.
2) At the "Microsoft Telnet>" prompt type in "set localecho"
3) It responds "Local echo on", and you should now be able see what you are typing.
- Tony