# 超文本传输协议 HTTP

## HTTP 的报文结构

<figure><img src="/files/iJopZTqWCbXSIjvNEb77" alt=""><figcaption></figcaption></figure>

**HTTP 请求报文和响应报文都是由三个部分组成的：**

1. **开始行，用于区分是请求报文还是响应报文**。
   * 在请求报文中的开始行叫做请求行 （Request-Line），而在响应报文中的开始行叫做状态行（Status-Line）。
     * **“请求行”包含三项内容：方法，请求资源的 URL ，以及 HTTP 的版本**
     * **“状态行”包含三项内容：HTTP 的版本，状态码，以及解释状态码的简单短语。**
   * 在开始行的三个字段之间都以空格分隔开，最后的“CR”和“LF”分别代表“回车”和“换行”。
2. **首部行**，用来说明浏览器、服务器或报文主体的一些信息。
   * **在每一个首部行中都有首部字段名和它的值**，每一行在结束的地方都要有“回车”和“换行”。
   * **整个首部行结束时，还有一空行将首部行和后面的实体主体分开。**
3. **实体主体（entity body）**


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://bohans.gitbook.io/ji-chu/network/tcpip-wang-luo-mo-xing/ying-yong-ceng/chao-wen-ben-chuan-shu-xie-yi-http.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
