HTTP1.1跟HTTP1.0的区别
Persistent Connection(持久连接) 在HTTP1.0中,每对Request/Response都使用一个新的连接。 HTTP 1.1则 支持Persistent Connection, 并且默认使用persistent connection. Host 域 HTTP1.1在Request消息头里头多了一个Host域,比如: GET /pub/WWW/TheProject.html HTTP/1.1 Host: www.w3.org HTTP1.0则没有这个域。 可能HTTP1.0的时候认为,建立TCP连接的时候已经指定了IP地址,这个IP地址上只有一个host。 date/time stamp (日期时间戳) (接收方向) 无 论是HTTP1.0还是HTTP1.1,都要能解析下面三种date/time stamp: Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format (发送方向) HTTP1.1则要求只生成RFC 1123(第一种)格式的date/time stamp。 Transfer Codings HTTP1.1支持chunked transfer,所以可以有Transfer-Encoding头部域: Transfer-Encoding: chunked HTTP1.0则没有。 Quality Values HTTP1.1多了 个qvalue域: qvalue = ( "0" [ "." 0*3DIGIT ] ) | ( "1" [ "." 0*3("0") ] ) 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方法. Method = "OPTIONS" ; Section 9.2 | "GET" ; Section 9.3 | "HEAD" ; Section 9.4 | "POST" ; Section 9.5 | "PUT" ; Section 9.6 | "DELETE" ; Section 9.7 | "TRACE" ; Section 9.8 | "CONNECT" ; Section 9.9 | extension-method extension-method = token Status code HTTP1.1 增加的新的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
HTTP1.0要求不能生成第三种asctime格式的date/time stamp;