Home > Common Problem > How many parts does an HTTP message consist of?

How many parts does an HTTP message consist of?

coldplay.xixi
Release: 2020-06-28 14:09:09
Original
12624 people have browsed it

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.

How many parts does an HTTP message consist of?

##HTTP message consists of 3 parts:

  • Describes the message A start line,

  • a header block containing attributes,

  • , and optionally a body containing data (body) part.

How many parts does an HTTP message consist of?

Related learning recommendations:

PHP Programming from entry to master

This is the format of the request message:​​​​​​

 //是为服务器端提供一些额外的信息
<method> <request-URL> <version>
<headers>
<entity-body>
Copy after login

This is the format of the response message (note that only the syntax of the starting line is different Different):          

  //为客户端提供一些额外的信息
<version> <status> <reason-phrase>
<headers>
<entity-body>
Copy after login

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 lines

HTTP/1.0 200 NOT OK and HTTP/1.0 200 OK is different, both will is treated as a success indication.

5. Header

can have zero or more headers. Each header contains a name, followed by a colon (:), then an optional space, followed by A value, and finally a CRLF. The header is terminated by a blank line (CRLF), indicating the end of the header list and the beginning of the entity body. Some HTTP versions, such as HTTP/1.1, require that valid request or response messages must contain specific headers. Various HTTP headers will be discussed later in this chapter.

6. The body of the entity (entity-body)

The body of the entity contains a data block composed of arbitrary data. Not all messages contain the main body of the entity. Sometimes, the message just ends with a CRLF

How many parts does an HTTP message consist of?##                                                                                                                                                     // Tell the server which media types it can send

         How many parts does an HTTP message consist of? //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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template