Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the meaning of HTTP agreement

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces what the meaning of HTTP protocol is, has a certain reference value, interested friends can refer to, I hope you have a lot of gains after reading this article, let Xiaobian take you to understand.

1. Use Google/Firefox Analytics

In Web applications, the server sends the web page to the browser, which essentially sends the HTML code of the web page to the browser for display. The transport protocol between browser and server is HTTP, so:

HTML is a text used to define web pages, HTML, you can write web pages;

HTTP is a protocol for transmitting HTML over the Web, used for communication between browsers and servers.

Chrome provides a complete set of debugging tools, ideal for Web development.

After installing Chrome browser, open Chrome, select "View","Developer","Developer Tools" in the menu, you can display developer tools:

HTML5 front-end development entry knowledge points: HTTP protocol meaning detailed explanation

description

Elements shows the structure of a web page

Network Shows communication between browsers and servers

We click Network, make sure the first little red light is on, and Chrome will record all browser-server traffic:

HTML5 front-end development entry knowledge points: HTTP protocol meaning detailed explanation

2. Analysis of http protocol

When we enter www.baidu.com in the address bar, the browser will display Baidu's home page. What does the browser do in this process? Through the Network records, we can know. In Network, find www.baidu.com that record, click, the right side will display Request Headers, click the view source on the right, we can see the browser sent to Sina server request:

2.1 browser request

HTML5 front-end development entry knowledge points: HTTP protocol meaning detailed explanation

HTML5 front-end development entry knowledge points: HTTP protocol meaning detailed explanation

description

The first two main lines are analyzed as follows, the first line:

GET / HTTP/1.1

GET indicates a read request that will fetch web page data from the server,/indicates the path to the URL, the URL always starts with/,/indicates the home page, and the last HTTP/1.1 indicates that the HTTP protocol version used is 1.1. The current version of the HTTP protocol is version 1.1, but most servers also support version 1.0, the main difference is that version 1.1 allows multiple HTTP requests to multiplex a TCP connection to speed up transmission.

Starting with the second line, each line looks like Xxx: abcdefg:

Host: www.baidu.com

The requested domain name is www.baidu.com. If a server has multiple websites, the server needs to use Host to distinguish which website the browser requests.

2.2 server response

Continue down to Response Headers and click view source to display the raw response data returned by the server:

HTML5 front-end development entry knowledge points: HTTP protocol meaning detailed explanation

HTTP response is divided into two parts: Header and Body (Body is optional). The most important lines of Header we see in Network are as follows:

HTTP/1.1 200 OK

200 indicates a successful response, followed by OK.

If the return is not 200, then there are often other functions, such as

404 Not Found: The page does not exist.

500 Internal Server Error

... Wait a minute...

Content-Type: text/html

Content-Type indicates the content of the response, here text/html for HTML pages.

Note that browsers rely on Content-Type to determine whether the content of the response is a web page or an image, video or music. Browsers don't rely on URLs to determine the content of a response, so even if the URL is http://www.baidu.com/meimei.jpg, it doesn't have to be an image.

HTTP response Body is HTML source code, we select "View" in the menu bar,"Developer","View web source code" can be directly viewed in the browser HTML source code.

Thank you for reading this article carefully. I hope that the article "What is the meaning of HTTP protocol" shared by Xiaobian will be helpful to everyone. At the same time, I hope that everyone will support it a lot and pay attention to the industry information channel. More relevant knowledge is waiting for you to learn!

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: 226

*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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report