RFC 9110 - HTTP Semantics (HTTP语义)
发布日期: 2022年6月
状态: Internet Standard (STD 97)
作者: R. Fielding (Ed.), M. Nottingham (Ed.), J. Reschke (Ed.)
废止: RFC 7230, RFC 7231, RFC 7232, RFC 7233, RFC 7235
摘要 (Abstract)
超文本传输协议 (Hypertext Transfer Protocol, HTTP) 是一系列无状态的、应用层的请求/响应协议,这些协议共享通用接口、可扩展语义和自描述消息,以实现与基于网络的超文本信息系统的灵活交互。本文档定义了 HTTP 的语义:架构、术语、请求方法、响应状态码、头部字段等核心内容。
重要性: 这是 HTTP 的最新核心规范(2022年),适用于 HTTP/1.1、HTTP/2 和 HTTP/3 所有版本。
目录 (Contents)
主要章节
-
- 1.1. Purpose (目的)
- 1.2. History and Evolution (历史和演进)
- 1.3. Core Semantics (核心语义)
- 1.4. Specifications Obsoleted by This Document (本文档废止的规范)
-
- 2.1. Syntax Notation (语法符号)
- 2.2. Requirements Notation (需求符号)
- 2.3. Length Requirements (长度需求)
- 2.4. Error Handling (错误处理)
- 2.5. Protocol Version (协议版本)
-
3. Terminology and Core Concepts (术语和核心概念)
- 3.1. Resources (资源)
- 3.2. Representations (表示)
- 3.3. Connections, Clients, and Servers (连接、客户端和服务器)
- 3.4. Messages (消息)
- 3.5. User Agents (用户代理)
- 3.6. Origin Server (源服务器)
- 3.7. Intermediaries (中间人)
- 3.8. Caches (缓存)
- 3.9. Example Message Exchange (消息交换示例)
-
4. Identifiers in HTTP (HTTP中的标识符)
- 4.1. URI References (URI引用)
- 4.2. HTTP-Related URI Schemes (HTTP相关的URI方案)
- 4.3. Authoritative Access (权威访问)
-
- 5.1. Field Names (字段名称)
- 5.2. Field Lines and Combined Field Value (字段行和组合字段值)
- 5.3. Field Order (字段顺序)
- 5.4. Field Limits (字段限制)
- 5.5. Field Values (字段值)
- 5.6. Common Rules for Defining Field Values (定义字段值的通用规则)
-
- 6.1. Framing and Completeness (帧和完整性)
- 6.2. Control Data (控制数据)
- 6.3. Header Fields (头部字段)
- 6.4. Content (内容)
- 6.5. Trailer Fields (尾部字段)
- 6.6. Message Metadata (消息元数据)
-
7. Routing HTTP Messages (HTTP消息路由)
- 7.1. Determining the Target Resource (确定目标资源)
- 7.2. Host and :authority
- 7.3. Routing Inbound Requests (路由入站请求)
- 7.4. Rejecting Misdirected Requests (拒绝误导的请求)
- 7.5. Response Correlation (响应关联)
- 7.6. Message Forwarding (消息转发)
- 7.7. Message Transformations (消息转换)
- 7.8. Upgrade (升级)
-
8. Representation Data and Metadata (表示数据和元数据)
- 8.1. Representation Data (表示数据)
- 8.2. Representation Metadata (表示元数据)
- 8.3. Content-Type
- 8.4. Content-Encoding
- 8.5. Content-Language
- 8.6. Content-Length
- 8.7. Content-Location
- 8.8. Validator Fields (验证器字段)
-
- 9.1. Overview (概述)
- 9.2. Common Method Properties (通用方法属性)
- 9.3. Method Definitions (方法定义)
-
- 10.1. Request Context Fields (请求上下文字段)
- 10.2. Response Context Fields (响应上下文字段)
-
11. HTTP Authentication (HTTP认证)
- 11.1. Authentication Scheme (认证方案)
- 11.2. Authentication Parameters (认证参数)
- 11.3. Challenge and Response (质询和响应)
- 11.4. Credentials (凭据)
- 11.5. Establishing a Protection Space (Realm) (建立保护空间)
- 11.6. Authenticating Users to Origin Servers (向源服务器认证用户)
- 11.7. Authenticating Clients to Proxies (向代理认证客户端)
-
12. Content Negotiation (内容协商)
- 12.1. Proactive Negotiation (主动协商)
- 12.2. Reactive Negotiation (被动协商)
- 12.3. Request Content Negotiation (请求内容协商)
- 12.4. Content Negotiation Field Features (内容协商字段特性)
- 12.5. Content Negotiation Fields (内容协商字段)
-
13. Conditional Requests (条件请求)
- 13.1. Preconditions (前提条件)
- 13.2. Evaluation of Preconditions (前提条件的评估)
-
- 14.1. Range Units (范围单位)
- 14.2. Range
- 14.3. Accept-Ranges
- 14.4. Content-Range
- 14.5. Partial PUT (部分PUT)
- 14.6. Media Type multipart/byteranges
-
- 15.1. Overview of Status Codes (状态码概述)
- 15.2. Informational 1xx (信息性响应)
- 15.3. Successful 2xx (成功响应)
- 15.4. Redirection 3xx (重定向响应)
- 15.5. Client Error 4xx (客户端错误)
- 15.6. Server Error 5xx (服务器错误)
-
- 16.1. Method Extensibility (方法扩展性)
- 16.2. Status Code Extensibility (状态码扩展性)
- 16.3. Field Extensibility (字段扩展性)
- 16.4. Authentication Scheme Extensibility (认证方案扩展性)
- 16.5. Range Unit Extensibility (范围单位扩展性)
- 16.6. Content Coding Extensibility (内容编码扩展性)
- 16.7. Upgrade Token Registry (升级令牌注册表)
-
17. Security Considerations (安全考虑)
- 17.1. Establishing Authority (建立权威)
- 17.2. Risks of Intermediaries (中间人的风险)
- 17.3-17.16. [多项安全主题]
-
18. IANA Considerations (IANA考虑)
- 18.1. URI Scheme Registration (URI方案注册)
- 18.2. Method Registration (方法注册)
- 18.3-18.10. [其他注册表]
-
- 19.1. Normative References (规范性参考文献)
- 19.2. Informative References (信息性参考文献)
附录 (Appendices)
相关资源
- 官方原文: RFC 9110
- 官方页面: RFC 9110 DataTracker
- 勘误表: RFC Editor Errata
快速理解 RFC 9110
HTTP 规范的重大重组
RFC 9110 是 2022 年发布的最新 HTTP 核心规范,它整合并替代了之前的 RFC 7230-7235 系列:
旧规范 (2014年):
- RFC 7230 - 消息语法和路由
- RFC 7231 - 语义和内容
- RFC 7232 - 条件请求
- RFC 7233 - 范围请求
- RFC 7234 - 缓存
- RFC 7235 - 认证
新规范 (2022年):
- RFC 9110 - 语义 (本RFC) ← 核心统一规范
- RFC 9111 - 缓存
- RFC 9112 - HTTP/1.1
- RFC 9113 - HTTP/2
- RFC 9114 - HTTP/3
为什么重要?
RFC 9110 定义了所有 HTTP 版本共享的语义,无论使用 HTTP/1.1、HTTP/2 还是 HTTP/3,都遵循相同的语义规则。这使得 HTTP 协议更加统一和易于理解。