Review
- 2024-09-26 22:09
[!Summary] HTTP https://developer.mozilla.org/zh-CN/docs/Web/HTTP 超文本传输协议(HTTP)是一个用于传输超媒体文档(例如 HTML)的应用层协议。它是为 Web 浏览器与 Web 服务器之间的通信而设计的,但也可以用于其他目的。HTTP 遵循经典的客户端—服务端模型,客户端打开一个连接以发出请求,然后等待直到收到服务器端响应。HTTP 是无状态协议,这意味着服务器不会在两个请求之间保留任何数据(状态)。
HTTP is defined by these IETF RFCs and IANA registries. The IETF HTTP Working Group maintains and develops the Hypertext Transfer Protocol - the core protocol of the World Wide Web.
[!Summary] 书籍推荐📚
- 《图解HTTP》2014
- 《HTTP权威指南》2012
- 《TCP/IP详解》卷1:协议 2016
- 《HTTP/2 in Action》
- 《HTTPS权威指南》
- 《解析QUIC/HTTP3:未来互联网的基石》2024/07
在线学习平台
- MDN HTTP
- HTTP Documentation
- HTTP Extensions
- RFC https://datatracker.ietf.org/
- HTTP-WG https://httpwg.org/
必读资料
[!Warning] Core Specifications
The “core” semantics of the HTTP protocol are defined by:
- RFC 9110: HTTP Semantics
- RFC 9111: HTTP Caching
Those semantics are expressed “on the wire” in three ways:
Later versions of HTTP offer field compression:
- RFC 7541: HPACK Header Compression for HTTP/2
- RFC 9204: QPACK Field Compression for HTTP/3
These RFCs collectively obsolete all preceding RFCs defining HTTP, including RFC 1945, RFC 2068, RFC 2616, RFC 2617, RFC 7230-5, and RFC 7540.
一、Introduction #
Message Format #
HTTP-message = start-line CRLF
*( field-line CRLF )
CRLF
[ message-body ]start-line = request-line / status-line
请求 #
请求行
消息头
消息体响应 #
状态行
消息头
消息体准确来说,响应消息体的格式会通过响应的消息头中的
Content-Type字段来定义(MIME类型)。
Web服务器 #
- Nginx
- Apache/ApacheHTTPD
- Apache Traffic Server
- LiteSpeed
- H2O
- IIS
nghttpd- NodeJS
- Shimmercat
- CaddyServer
- HAProxy
- HS
- AWS ELB
- LiteSpeed
查看HTTP请求的工具 #
- curl
- wget
httpienc(netcat)- Wireshark
- Fiddler
- Chrome
net-internalschrome://net-export/ chrome://net-internals/ https://netlog-viewer.appspot.com/ - Advanced REST Client
- Postman
- Rested
- RESTClient
- RESTMan
nghttp基于 Firefox 实现