翻了下HTTP1.1的协议标准RFC2616,下面是看到的一些它跟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.0要求不能生成第三种asctime格式的date/time stamp;
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.1增加了Content Negotiation,分为Server-driven Negotiation,Agent-driven Negotiation和Transparent Negotiation三种。
Cache (缓存)
HTTP1.1(RFC2616)详细展开地描述了Cache机制,详见13节。
依据:
rfc2616 Hypertext Transfer Protocol -- HTTP-1.1.txt
rfc1945 Hypertext Transfer Protocol -- HTTP 1.0.txt
转自:http://blog.sina.com.cn/s/blog_663432950100heaa.html
分享到:
相关推荐
修改了ghttp的源码,使其修复chunk传输bug
http chunk
fix HTTP/1.1 chunk formatting; from "propanbutan" allow 64-bit content lengths; from Scott Lamb and more... libevent-1.4.1-beta.tar.gz [GPG Sig] - ChangeLog - Release 2007-12-21 fixed some memory ...
一个用C语言实现的解析HTTP chunked方式传输的数据包的演示程序
HTTP chunk数据包 服务器端发送的数据格式有俩类,我称之为按长度返回、按块返回这俩类。一类是在返回头中有Content-Length: 258,258标识该正文内容长度;还有一类是返回Transfer-Encoding: chunked。
chunk编码解析流程
An HTTP body with alternating chunk sizes and chunk bodies.
An HTTP body with alternating chunk sizes and chunk bodies Source Code for Linux v2.13.6.
HTTP Chunk协议等
chunk编码规则
chunk 有关代码 chunk 有关代码chunk 有关代码
chunk_type
块.js Chunk.js 是一个 javascript 库,它允许您为您的网页分部分下载任何资源。用法并行下载图像数据通过并行打开 3 个连接下载路径 /data/4.jpg 中的图像。 image = new Chunk("/data/4.jpg", 3, each_chunk_...
netty案例,netty4.1中级拓展篇十一《Netty基于ChunkedStream数据流切块传输》源码 ...
纯函数和副作用函数,AMD CMD CommonJs,module、chunk、bundle有什么区别,vdom优缺点,vmin/vmax 概述(B站为什么使用的是vmin),清除浮动,script标签中的defer等等等。 冲大厂必备,社招必备,已经帮助近百名...
朱冬青的文本分块PPT,TEXT CHUNKING
纯函数和副作用函数,AMD CMD CommonJs,module、chunk、bundle有什么区别,vdom优缺点,vmin/vmax 概述(B站为什么使用的是vmin),清除浮动,script标签中的defer等等等。 冲大厂必备,社招必备,已经帮助近百名...
Android Chunk format reader/writer This project contains classes extracted from the android-arscblamer project that deal with reading and writing the resource table and compiled XML files present in ...
解析http的chunk数据
最新独立版智狐聚合支付v1.0.5.21_聚合支付系统源码 PHP聚合支付源码 独立版智狐聚合支付v1.0.5.21 1、在宝塔新建个站点,php版本使用7.3 或 7.4,运行目录设置为/public,关闭防跨站攻击 2、导入数据库文件,...