翻了下HTTP1.1的协议标准RFC2616,下面是看到的一些它跟HTTP1.0的差别。
Persistent Connection(持久连接)
在HTTP1.0中,每对Request/Response都使用一个新的连接。
HTTP 1.1则支持Persistent Connection, 并且默认使用persistent connection.
Host 域
HTTP1.1在Request消息头里头多了一个Host域,比如:
date/time stamp (日期时间戳)
(接收方向)
无论是HTTP1.0还是HTTP1.1,都要能解析下面三种date/time stamp:
(发送方向)
Transfer Codings
HTTP1.1支持chunked transfer,所以可以有Transfer-Encoding头部域:
Transfer-Encoding: chunked
Quality Values
HTTP1.1多了个qvalue域:
Entity Tags
用于Cache。
Range 和 Content-Range
HTTP1.1支持传送内容的一部分。比方说,当客户端已经有内容的一部分,为了节省带宽,可以只向服务器请求一部分。
100 (Continue) Status
100 (Continue) 状态代码的使用,允许客户端在发request消息body之前先用request header试探一下server,看server要不要接收request body,再决定要不要发request body。
客户端在Request头部中包含
Expect: 100-continue
Server看到之后呢如果回100 (Continue) 这个状态代码,客户端就继续发request body。
这个是HTTP1.1才有的。
Request method
HTTP1.1增加了OPTIONS, PUT, DELETE, TRACE, CONNECT这些Request方法.
Status code
(HTTP1.0没有定义任何具体的1xx status code, HTTP1.1有2个)
100 Continue
101 Switching Protocols
203 Non-Authoritative Information
205 Reset Content
206 Partial Content
302 Found (在HTTP1.0中有个 302 Moved Temporarily)
303 See Other
305 Use Proxy
307 Temporary Redirect
405 Method Not Allowed
406 Not Acceptable
407 Proxy Authentication Required
408 Request Timeout
409 Conflict
410 Gone
411 Length Required
412 Precondition Failed
413 Request Entity Too Large
414 Request-URI Too Long
415 Unsupported Media Type
416 Requested Range Not Satisfiable
417 Expectation Failed
504 Gateway Timeout
505 HTTP Version Not Supported
Content Negotiation
Cache (缓存)
HTTP1.1(RFC2616)详细展开地描述了Cache机制,详见13节。
依据: