http协议以及http1.0和http1.1的区别

header响应头信息:

HTTP/1.1 302 FOUND
Content-Length: 0
Set-Cookie: sessionid=n3gozvqbjba1zckr7v0ccj6yn7v96oh8; expires=Tue, 21-Mar-2017 02:57:34 GMT; httponly; Max-Age=300; Path=/
Vary: Cookie
Server: TornadoServer/4.3
Location: http://jumpserver.i.beebank.com/
X-Frame-Options: SAMEORIGIN
Content-Type: text/html; charset=utf-8

header请求头信息:

POST /login/ HTTP/1.1
Host: jumpserver.i.beebank.com
Connection: keep-alive
Content-Length: 47
Cache-Control: max-age=0
Origin: http://jumpserver.i.beebank.com
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Referer: http://jumpserver.i.beebank.com/login/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.8,en;q=0.6
Cookie: csrftoken=VwENAPzCENfcXVmw6tCBjTvQ2d99n1jU; sessionid=pwk41j162z9yr6go4fi97zxnulmrrcfn

http1.0使用keep-alive告知server端需要建立一个长连接,而http1.1默认支持长连接;

http1.1一开始只发送header信息,如果server返回200,表示有权限访问,然后才发送body信息,如果server返回401,表示该请求没有权限,就不会发送body的信息;

http1.1支持host域;

原文地址:https://www.cnblogs.com/cqq-20151202/p/6593590.html