Telnet can be used to establish an HTTP connection with the server, obtain Web pages, and implement browser functions.
It is very convenient to observe and test the HTTP header. Because the browser does not see the HTTP header.
The steps are as follows:
telnet www.csua.berkeley.edu
inputget/officers.html http/1.0and 2 times to enter.
at this point, you should see the HTTP response, including the header and body.
because window takes itself to telnet when the input content is not visible, you can download putty and choose Raw TCP connection to connect.
It is important to note the following:
1. GET and HTTP must be capitalized, because many servers require uppercase and lowercase words can cause a connection failure in some servers.
2. HTTP1.1, it is also necessary to add a line to indicate the host, which is http1.1 requirements.
get/officers.html http/1.1
Host:www.csua.berkeley.ed
another reason to add host here is because many sites are in the form of a virtual host, which is required by host to distinguish it from other virtual hosts on the same host.
3.2 returns indicates that the request was sent, because the HTTP request ended with a null line in the last action.
4. Some smarter websites will block out HTTP request that is not a browser, then we need to impersonate the browser and need the set user-agent.
get/officers.html http/1.1
Host:www.csua.berkeley.ed
user-agent:mozilla/5.0 (Windows; U Windows NT 5.1; En-us; rv:1.9.0.5) gecko/2008120122 firefox/3.0.5
5. The package that crawls the HTTP connection can use Wireshark, get the HTTP request and response of the browser, and then connect using Telnet to simulate the browser.
Telnet establish HTTP connection to get Web page HTML content