In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what are the knowledge points of http messages". In daily operation, I believe many people have doubts about what are the knowledge points of http messages. The editor has consulted all kinds of materials and sorted out simple and easy operation methods. I hope it will help you answer the doubts about "what are the knowledge points of http messages"! Next, please follow the small series to learn together!
http message composition
start-line: The starting line, describing the basic information of the request or response
*( header-field CRLF ): Head
CRLF
[ message-body ]: Message body, actual data transmitted
header start line
The format of the starting line is
start-line = request-line(request start line)/(response start line) status-line
header header
These formats are the rules that are used to parse
order
Theoretically, the key order of the header fields does not matter, but the best practice is to put the control fields first, such as Host, Date of the response when requesting, so that you can find out whether you need to process it as soon as possible.
repeated
Nothing works except Set-Cookie. If the sender sends a duplicate key, the receiver will merge it, and the values are separated by commas.
field restriction
The protocol itself has no restrictions on each header field, but engineering practice has led to some practice, no general restrictions, and field specific semantics. The overall header size limit has no defined standard value, some 4K, some 8K. The server checks that the header exceeds the limit value. For safety reasons, it will not be ignored. Instead, it throws a 4XX error.
Only the Host field is required in the request header, and the rest doesn't matter.
field request header response header interpretation Host10 tells the server which host should handle User-Agent10 identifies browser type, although it is used badly, not very trusted, but sometimes can be used to customize the type Accept10 can receive body type mime type, For example, text/htmlAccept-Charset10 can receive character sets Accept-Encoding10 can receive encoding formats Accept-Language10 can receive multilingual Content-Type11 sent body type mime typeContent-Encoding11 sent encoding Content-Language11 Language sent
body
The header must be present, but the body does not have to be present.
The body is the content of the transmission. Because Http is an application layer protocol, in addition to transmitting data, it is also necessary to define the data format for transmission. These format definitions are specified in the header. Content-Length The length of the body of the request or response. This field must be included so that the other party can easily distinguish the boundary of the message, that is, when the Body data ends. If the Body is too large, it needs to be transmitted while calculating, and the size of the whole Body cannot be known until the final calculation is completed. At this time, you can use chunk transmission to specify through Transfer-Encoding. These two header keys are mutually exclusive, and only one can be specified. If two are specified, the receiver will process the Transfer-Encoding field first. Usually, when the body data is relatively large, it is transmitted using chunks, which is more efficient. Without length, how do you know that the data transmission is over? Through a chunk of length 0, the corresponding block data has no content to indicate the end of the body content.
What did jetty do?
jetty is a web container, need to parse Http Request, send Http Response
At this point, the study of "what are the knowledge points of http message" is over, hoping to solve everyone's doubts. Theory and practice can better match to help you learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
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.