In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of what the HTTP request message and response message is, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will gain something after reading this HTTP request message and response message. Let's take a look.
HTTP message is text-oriented, each field in the message is some ASCII code string, the length of each field is uncertain. HTTP has two types of messages: request message and response message.
HTTP request message 1 is the request method. GET and POST are the most common HTTP methods, including DELETE, HEAD, OPTIONS, PUT and TRACE for the first time. But now most browsers only support that GET and POST2 are the corresponding URL address of the request, which is combined with the Host attribute of the header to form a complete request URL3 is the protocol public name and version number 4 is the header, and there are several attributes in the form of key:val, according to which the server obtains the client information. 5 is the message style, which encodes the component values in a page form into a formatted string in the form of param1=val1&parma=2 key-value pairs. It carries the data of multiple request parameters, not only the header can pass the request parameters, but also the URL can pass the request parameters through / chapter15/user.html? Pass numeric HTTP request header attributes in the way of "param1=value1¶m2=value2"
❝
What is the header attribute and what is the use of the header attribute?
For example, when you are in the company's cv code, suddenly hunger attacks, you call, ask the restaurant downstairs to deliver a takeout, you say to the boss: boss, give me the cheapest meal, send it to xxx, I call the loser programmer
Here you want to cover rice equivalent to the newspaper style, and I call the loser programmer this kind of information is equivalent to the newspaper style, he is some subsidiary attributes, in order to make your transaction more smooth.
❝
So the attribute of the header of HTTP is to make the client and browser more convenient and smooth.
Common HTTP header attributes
Accpet
Tell the server what type of response the client receives
Referer
Indicates from which URL the request came in, for example, if you want to shop online, but you don't know which e-commerce platform to choose, you ask du Niang which e-commerce things are cheap, and then a bunch of things pop up in front of you. The first thing is a treasure. When you enter a treasure from here, the Referer of this request message is www.baidu.com.
Cache-Control
Control the cache, such as the content that a request wants to respond to is cached on the client for one year, or not cached can be set through this header
Accept-Encoding
For example: Accept-Encoding:gzip, deflate (both are compressed formats) this attribute is used to tell the server which encoding format can accept, including character encoding, compressed form (usually compressed form)
Host
Specify the host and port where the resource to be requested is located
User-Agent function: tell the server the operating system, browser version and name used by the client
HTTP response message
❝
Like the request message, the response message consists of three parts (response line, response header, response body).
Image.png
1 message protocol and version; 2 status code and status description; 3 response header, which is also composed of multiple attributes; 4 response style, that is, the data we want. HTTP status code
Image.png
❝
Briefly talk about a few common status codes
200 OK means you are redirected to another page without modification. You can directly use the local cache 404 to find no page (page deleted or other). 500 server error HTTP response message attribute
Cache-Control
After the response is output to the client, the server tells the client how to control the cache of the response content through this attribute.
ETag
Indicates the version of the resource you are requesting. If the resource changes, this property will change as well.
Location
Used in redirecting or when creating new resources
Set-Cookie
The server can set up the client's cookie on the HTTP request message and response message. This article ends here. Thank you for your reading. I believe you all have a certain understanding of the knowledge of "what is the HTTP request message and response message". If you want to learn more, you are welcome to follow the industry information channel.
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.