跳到主要内容

3.3. 丰富功能

3.3. 丰富功能 (Rich Functionality)

HTTP 为 application 提供许多功能, 例如:

  • Message framing 由 protocol 处理, 这意味着 application 不需要定义自己的 framing.

  • HTTP caching 允许复用 response. 见 Section 4.9.

  • HTTP method, status code 和 header field 为 protocol operation 和 metadata 提供通用词汇.

  • Authentication 已标准化. 见 Section 4.12.

  • Content negotiation 允许一个 resource 具有多个 representation. 见 Section 4.8.

  • range request 机制允许检索 partial content. 见 [HTTP] Section 14.

  • Expect/Continue 机制允许 client 在发送可能大量 content 之前获得关于 request 的反馈. 见 [HTTP] Section 10.1.1.

  • HTTP/2 [HTTP/2] 和 HTTP/3 [HTTP/3] 提供若干功能, 包括在一个 connection 上 multiplex 多个 message, 对其进行 prioritising, 以及启用 server push. 见 Section 4.15.

只要不违反 HTTP semantics, application 就可以使用现有 HTTP functionality, 而不是定义自己的功能. 换言之, 使用这些功能比重新发明它们工作量更小.