RFC 7231 - Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content
Published (发布日期): June 2014
Status (状态): Standards Track (Obsoleted by RFC 9110)
Authors (作者): R. Fielding (Ed.), J. Reschke (Ed.)
Abstract (摘要)
The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document defines the semantics of HTTP/1.1 messages, as expressed by request methods, request header fields, response status codes, and response header fields, along with the payload of messages (metadata and body content) and mechanisms for content negotiation.
超文本传输协议(HTTP)是一个用于分布式、协作式超文本信息系统的无状态应用层协议。本文档定义了HTTP/1.1消息的语义,包括请求方法、请求头字段、响应状态码和响应头字段所表达的语义,以及消息载荷(元数据和主体内容)和内容协商机制。
Table of Contents (目录)
Core Sections (核心章节)
-
- 1.1 Conformance and Error Handling (一致性与错误处理)
- 1.2 Syntax Notation (语法标记)
-
- 3.1 Representation Metadata (表示元数据)
- 3.2 Representation Data (表示数据)
- 3.3 Payload Semantics (载荷语义)
- 3.4 Content Negotiation (内容协商)
-
- 4.1 Overview (概述)
- 4.2 Common Method Properties (通用方法属性)
- 4.2.1 Safe Methods (安全方法)
- 4.2.2 Idempotent Methods (幂等方法)
- 4.2.3 Cacheable Methods (可缓存方法)
- 4.3 Method Definitions (方法定义)
- 4.3.1 GET
- 4.3.2 HEAD
- 4.3.3 POST
- 4.3.4 PUT
- 4.3.5 DELETE
- 4.3.6 CONNECT
- 4.3.7 OPTIONS
- 4.3.8 TRACE
-
5. Request Header Fields (请求头字段)
- 5.1 Controls (控制)
- 5.2 Conditionals (条件)
- 5.3 Content Negotiation (内容协商)
- 5.4 Authentication Credentials (认证凭证)
- 5.5 Request Context (请求上下文)
-
6. Response Status Codes (响应状态码)
- 6.1 Overview of Status Codes (状态码概述)
- 6.2 Informational 1xx (信息性响应)
- 6.3 Successful 2xx (成功响应)
- 6.4 Redirection 3xx (重定向)
- 6.5 Client Error 4xx (客户端错误)
- 6.6 Server Error 5xx (服务器错误)
-
7. Response Header Fields (响应头字段)
- 7.1 Control Data (控制数据)
- 7.2 Validator Header Fields (验证器头字段)
- 7.3 Authentication Challenges (认证质询)
- 7.4 Response Context (响应上下文)
-
- 11.1 Normative References (规范性引用)
- 11.2 Informative References (资料性引用)
Appendices (附录)
- Appendix A. Changes from RFC 2616 (与RFC 2616的变更)
- Appendix B. Imported ABNF (导入的ABNF)
- Appendix C. Collected ABNF (收集的ABNF)
- Appendix D. Index (索引)
Copyright Notice (版权声明)
Copyright (c) 2014 IETF Trust and the persons identified as the document authors. All rights reserved.
Related Resources (相关资源)
- Official Text (官方文本): RFC 7231 (TXT)
- Official Page (官方页面): RFC 7231 DataTracker
- Obsoletes (废弃): RFC 2616
- Obsoleted By (被废弃): RFC 9110 (HTTP Semantics)
Key Features (关键特性)
HTTP Method Properties (HTTP方法属性)
本文档详细定义了HTTP方法的三个核心属性:
- Safe Methods (安全方法): 只读操作,不会改变服务器状态
- Idempotent Methods (幂等方法): 多次执行与单次执行效果相同
- Cacheable Methods (可缓存方法): 响应可以被缓存
Method Summary (方法摘要)
| Method | Safe | Idempotent | Cacheable |
|---|---|---|---|
| GET | ✅ | ✅ | ✅ |
| HEAD | ✅ | ✅ | ✅ |
| POST | ❌ | ❌ | ⚠️ |
| PUT | ❌ | ✅ | ❌ |
| DELETE | ❌ | ✅ | ❌ |
| CONNECT | ❌ | ❌ | ❌ |
| OPTIONS | ✅ | ✅ | ❌ |
| TRACE | ✅ | ✅ | ❌ |