1. 消息格式: start line + headers + body
    Request Message:



Repsonse Message:



2.一共7种Method
HTTP,协议,学习总结_第1张图片

  1. 一共5大类Status Code
    HTTP,协议,学习总结_第2张图片

4.基于TCP的HTTP问题
如果采用TCP短连接会带来较大的延迟,原因:

  • TCP 三次握手(handshake)
  • TCP 延时确认(delay ack)
  • TCP 慢启动(slow start)
  • 服务器端频繁关闭TCP,导致TIME_WAIT Accumulation and Port Exhaustion

解决办法:

  • Parallel connections
    Concurrent HTTP requests across multiple TCP connections
    并行多TCP连接,
  • Persistent connections
    Reusing TCP connections to eliminate connect/close delays
    共有一个TCP长连接,HTTP/1.1 默认为长连接
    消除TCP connection延时
    delays
  • Pipelined connections
    Concurrent HTTP requests across a shared TCP connection
    消除数据传输延时(transfer latencies)
  • Multiplexed connections
    Interleaving chunks of requests and responses (experimental)

    1. 缓存控制
      HTTP,协议,学习总结_第3张图片
      HTTP,协议,学习总结_第4张图片

不缓存!
Cache-Control: no-store
Cache-Control: no-cache do-notserve-from-cache-without-revalidation.
Pragma: no-cache
Cache-Control: must-revalidate