HTTP message consists of 3 parts, namely: 1. The starting line [start line] that describes the message; 2. The header [header] block containing attributes; 3. Optional, Contains the main body part of the data.
##HTTP message consists of 3 parts:
Related learning recommendations:This is the format of the request message:
//是为服务器端提供一些额外的信息 <method> <request-URL> <version> <headers> <entity-body>
//为客户端提供一些额外的信息 <version> <status> <reason-phrase> <headers> <entity-body>
The following is a brief description of each part.
1. Method The action the client wants the server to perform on the resource. is a single word, such as GET, HEAD, or POST. Methods are detailed later in this chapter. 2. Request URL (request-URL) names the requested resource, or the complete URL of the URL path component. If you're talking to the server directly, there's usually no problem as long as the path component of the URL is an absolute path to the resource - the server can assume it's the host/port of the URL. Chapter 2 introduces the syntax of URL in detail. 3. Version Status code (status-code) These three digits describe what happened during the request. The first digit of each status code is used to describe the general category of status ("success", "error", etc.). A complete list of status codes and their meanings defined by the HTTP specification are provided later in this chapter. 4. Reason phrase A human-readable version of the numeric status code, including all text before the line termination sequence. Examples of reason phrases for all status codes defined by the HTTP specification are provided later in this chapter. Reason phrases only have meaning to humans, so, for example, although the meaning of the reason phrase in the response linesHTTP/1.0 200 NOT OK and
HTTP/1.0 200 OK is different, both will is treated as a success indication.
## // Tell the server which media types it can send
//Tell the server which encoding methods you can send
The above is the detailed content of How many parts does an HTTP message consist of?. For more information, please follow other related articles on the PHP Chinese website!