[四年前的博客了,协议真的很有用]
直接看RFC2616有点小崩溃,找了篇文章来http://www.360doc.com/content/10/0930/17/3668821_57590979.shtml,略带些重点摘抄:
HTTP: request, response...
Server can't push data without request..
Server with no 状态!
三次握手
A->B [SYN] seq=x(x=0)
B->A [SYN ACK] seq=y(y=0) ACK=x+1 (1)
A->B [ACK] seq=x+1 (1) ACK=y+1 (1)
接着,发送HTTP GET请求,这里有滑动窗口, (再研究,先略过)
HTTP 头,由域名,冒号,域值组成,可扩展为多行,每行开始处至少有一个空格或者制表符 <---why?
请求的开头类似于:
GET url..... HTTP/1.1 \r\n
Request Method: GET
Request URI:xxxx
Request Version: HTTP/1.1
Accept: */*
....
响应的头类似于:
HTTP/1.1 200 OK
Request Version: HTTP/1.1
Response Code: 200
Content-type: image/gif
...
还有这篇文章:http://www.cnblogs.com/shoru/archive/2010/02/19/1669395.html
谈了关于HTTP长连接,短连接,有状态,无状态的一些观点...
以我之见,长连接与短连接是属于传输层的,HTTP是无状态的,与连接方式无关,Session和Cookie赋予了Http状态,但他们又不属于Http协议。