RFC 7230 - Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing
文档信息
- RFC 编号: 7230
- 标题: HTTP/1.1: Message Syntax and Routing (消息语法与路由)
- 发布日期: 2014年6月
- 作者: R. Fielding (Adobe), J. Reschke (greenbytes)
- 状态: Standards Track
- 废弃: RFC 2616, RFC 2145
- 更新: RFC 2817, RFC 2818
摘要 (Abstract)
Hypertext Transfer Protocol (HTTP) 是一种用于分布式、协作式超文本信息系统的无状态应用层协议。本文档概述了 HTTP 架构及其相关术语,定义了 "http" 和 "https" 统一资源标识符 (URI) 方案,定义了 HTTP/1.1 消息语法和解析要求,并描述了实现相关的安全考虑事项。
文档结构 (Contents)
主要章节
-
Introduction (简介)
- 1.1 Requirements Notation (要求符号)
- 1.2 Syntax Notation (语法符号)
-
Architecture (架构)
- 2.1 Client/Server Messaging (客户端/服务器消息传递)
- 2.2 Implementation Diversity (实现多样性)
- 2.3 Intermediaries (中间方)
- 2.4 Caches (缓存)
- 2.5 Conformance and Error Handling (一致性与错误处理)
- 2.6 Protocol Versioning (协议版本控制)
- 2.7 Uniform Resource Identifiers (统一资源标识符)
-
Message Format (消息格式)
- 3.1 Start Line (起始行)
- 3.2 Header Fields (头部字段)
- 3.3 Message Body (消息主体)
-
Transfer Codings (传输编码)
- 4.1 Chunked Transfer Coding (分块传输编码)
- 4.2 Compression Codings (压缩编码)
- 4.3 TE Header Field
- 4.4 Trailer Header Field
-
Message Routing (消息路由)
- 5.1 Identifying a Target Resource (标识目标资源)
- 5.2 Connecting Inbound (入站连接)
- 5.3 Request Target (请求目标)
- 5.4 Host Header Field
- 5.5 Effective Request URI
- 5.6 Associating a Response to a Request
- 5.7 Message Forwarding (消息转发)
-
Connection Management (连接管理)
- 6.1 Connection Header Field
- 6.2 Establishment (建立连接)
- 6.3 Persistence (持久连接)
- 6.4 Concurrency (并发)
- 6.5 Failures and Timeouts (失败与超时)
- 6.6 Tear-down (拆除连接)
- 6.7 Upgrade Header Field
-
ABNF List Extension (ABNF 列表扩展)
-
IANA Considerations (IANA 考虑事项)
-
Security Considerations (安全考虑事项)
附录
- Appendix A - HTTP Version History (HTTP 版本历史)
- Appendix B - Collected ABNF (汇总的 ABNF)
- References (参考文献)
HTTP/1.1 规范系列
RFC 7230 是 HTTP/1.1 规范系列的第一部分,完整系列包括:
- RFC 7230 - Message Syntax and Routing (本文档)
- RFC 7231 - Semantics and Content (语义与内容)
- RFC 7232 - Conditional Requests (条件请求)
- RFC 7233 - Range Requests (范围请求)
- RFC 7234 - Caching (缓存)
- RFC 7235 - Authentication (认证)
关键概念
核心术语
- Client (客户端): 发起 HTTP 请求的程序
- Server (服务器): 接受连接并响应 HTTP 请求的程序
- User Agent (用户代理): 发起请求的客户端程序
- Origin Server (源服务器): 能够为给定资源生成权威响应的程序
- Intermediary (中间方): 代理、网关或隧道
- Cache (缓存): 存储先前响应的本地存储
消息结构
HTTP-message = start-line
*( header-field CRLF )
CRLF
[ message-body ]
请求示例
GET /hello.txt HTTP/1.1
Host: www.example.com
User-Agent: curl/7.16.3
Accept-Language: en, mi
响应示例
HTTP/1.1 200 OK
Date: Mon, 27 Jul 2009 12:28:53 GMT
Server: Apache
Content-Length: 51
Content-Type: text/plain
Hello World! My payload includes a trailing CRLF.
版权声明
Copyright © 2014 IETF Trust and the persons identified as the document authors. All rights reserved.
本文档遵循 BCP 78 和 IETF Trust's Legal Provisions,允许翻译成其他语言。
相关资源
- 官方文档: https://www.rfc-editor.org/rfc/rfc7230.html
- 勘误表: https://www.rfc-editor.org/errata_search.php?rfc=7230
- 更新信息: RFC 7230 已被 RFC 9110-9114 (HTTP Semantics) 废弃
翻译说明
本翻译遵循 RFC 翻译规范,提供中英文对照,旨在帮助中文开发者更好地理解 HTTP/1.1 协议规范。
翻译质量保证:
- ✅ 专业术语双语标注
- ✅ 完整的 ABNF 语法定义
- ✅ 关键概念详细说明
- ✅ 实际示例演示
📌 快速导航: 从 Section 1 - Introduction 开始阅读