RFC2616 HTTP/1.1 Reading Notes

Preview:

DESCRIPTION

Recently I finished reading the rfc2616, and have many gains to share

Citation preview

RFC2616 HTTP/1.1

Agenda

RFC2616 HTTP/1.1 概述 基础术语和概念 缓存 工具 讨论

RFC2616 HTTP/1.1 概述 The Hypertext Transfer Protocol

(HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems.

RFC2616 21 个章节 协议参数、消息、请求、响应、实体、连接、

方法、状态码、缓存、 Header

基础术语和概念 连接、消息、请求、响应、资源、实体、

表述、内容协商、变量、客户端、 User Agent 、代理、网关、隧道、缓存、可缓存、显式过期时间、启发式过期时间、语义透明、证言( Validator )

基础术语和概念 HTTP Operation

RequestUserAgent

Response

OriginServer

UserAgent

OriginServer

Request chain

Response chain

Intermediaries: Proxies, gateways, tunnels

基础术语和概念 协议的基本形式

基础术语和概念 协议的基本形式( Augmented BNF )

Name=definition(1#element) 协议的主要组成

Request Message Response Message

基础术语和概念 Request

Response

基础术语和概念 REQUEST 中的方法

OPTIONS GET HEAD POST PUT DELETE TRACE CONNECT

Status Code 状态码 1xx 信息性 2xx 成功性 3xx 重定向 4xx 客户端错误 5xx 服务端错误

HTTP 缓存 Caching would be useless if it did not

significantly improve performance. HTTP/1.1 中缓存的目的

尽量减少发送请求的需求,“截止”机制 尽量减少发送完整响应的需求,“证实”机制

缓存的正确性 与原始服务器检查是等效的 “ 足够新”满足服务器对于更新的需要 适当的 304 、 305 或错误 (4x,5x) 响应消息

Expiration Model

Server-specified Expiration Expires Cache-Control: max-age

Heuristic Expiration 启发式截止 Last-Modified

Expiration Model

Age Calculation Now – data_value Age value

Expiration Calculation Max-age 优先级高于 Expires 有 max-age 没有 max-age

Cache-Control

Cache-Control:max-age=0 Cache-Contro:no-cache

Expiration Model

Original Server

Cache Server 3Expiration:10:03

Cache Server 2Expiration:10:02

Cache Server 1Expiration:10:01

Validation Model

Last-Modified Dates Entity Tag Cache Validators - ETag Weak and Strong Validators

强证言:实体或 Header 变化,证言就发生变化

弱证言:只在语义改变明显时发生变化

工具 工具的用途 常见工具

Firefox Extension Live HTTP Headers IE Http Watch Chrome Developer Tools

LIVE HTTP HEADERS

IE HTPPWATCH

CHROME

展望 Browser Caching 不同服务器缓存类配置比较 缓存的运维控制

Recommended