In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "telnet establish http connection and get web HTML content". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "telnet establish http connection and get web HTML content".
Using telnet, you can establish a http connection with the server, obtain the web page, and realize the function of the browser.
It is very convenient for observing and testing http header. Because the browser can't see http header.
The steps are as follows:
Telnet www.csua.berkeley.edu 80
Enter GET / officers.html HTTP/1.0 and enter twice.
At this point you should be able to see http response, including header and body.
Because window itself brings it to telnet that you can't see what you enter when you type it, you can download putty and connect with raw tcp connection.
The things you need to note are as follows:
1. GET and HTTP must be uppercase, because many servers require uppercase, and lowercase will cause connection failure on some servers.
2. For HTTP1.1, you also need to add a line indicating host, which is the requirement of http1.1.
GET / officers.html HTTP/1.1
Host: www.csua.berkeley.ed
Another reason for adding host here is that many websites are in the form of virtual hosts, which are necessary to distinguish host from other virtual hosts on the same host.
3. 2 carriage returns means that the request is sent, because the http request ends with the last blank line.
4. Some of the smarter sites will block http request that is not a browser, so we need to pretend to be a browser and need set's 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. To grab the package of a http connection, you can use Wireshark to get the browser's http request and response, and then use telnet to simulate the browser to connect.
Thank you for your reading, the above is the content of "telnet establish http connection and get web HTML content". After the study of this article, I believe you have a deeper understanding of the problem of telnet establishing http connection and obtaining web HTML content, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.