HTTP的历史
HTTP/0.9(1991)
请求示例:
telnet example.com 80
GET /
<html>...
?
主要特性:
- 仅支持GET方法
- 响应类型仅超文本
- 没有HTTP header
- 连接在文档传输完毕后断开
备注:现在基本上大部分服务器已经不支持
HTTP/1.0(1996)
请求:
telnet example.com 80
GET / HTTP/1.0
User-Agent: HappyBrowser
Accept: */*
响应:
HTTP/1.0 200 OK
Content-Type: text/html
Server: HappyServer
<h1>It works</h1>
?
主要特性:
- 增加了请求和响应header的支持(HTTP版本号、响应码和contentType)
- 响应内容不在局限超文本(Content-Type用来标记其他资源的能力,如脚本、样式或媒体文件)
- 增加了HEAD、POST方法的支持
- 连接在响应传输完毕后依然会断开
HTTP/1.1 最常见的版本
http1.1 的标准最初是1999年提出,后来又不断有新的功能加入。
请求:
GET /sales/ HTTP/1.1
Host: www.mafengwo.cn
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Referer: http://www.mafengwo.cn/
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: mfw_uuid=5c74d16c-0900-dc1c-5d20-c579f2cbf02c; uva=s%3A78%3A%22a%3A3%3A%7Bs%3A2%3A%22lt%22%3Bi%3A1551160082%3Bs%3A10%3A%22last_refer%22%3Bs%3A6%3A%22direct%22%3Bs%3A5%3A%22rhost%22%3Bs%3A0%3A%22%22%3B%7D%22%3B; __mfwurd=a%3A3%3A%7Bs%3A6%3A%22f_time%22%3Bi%3A1551160082%3Bs%3A9%3A%22f_rdomain%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22f_host%22%3Bs%3A3%3A%22www%22%3B%7D; __mfwuuid=5c74d16c-0900-dc1c-5d20-c579f2cbf02c; UM_distinctid=16928588422186-0b9d939d8c4e34-36667105-13c680-169285884234f; mafengwo=9f8394af8a9966831e7983269da5caca_57022634_5c8b78a19ede19.06690157_5c8b78a19ede83.17999445; mfw_uid=57022634; PHPSESSID=folqrtiba2scaf4l5m80tn7bf4; __omc_chl=; __jsluid_h=844a8202521a956499032b60f37c890d; __mfwothchid=referrer%7Cwww.google.com; __mfwc=referrer%7Cwww.google.com; Hm_lvt_8288b2ed37e5bc9b4c9f7008798d2de0=1561357018,1561618439,1562290042,1563286896; oad_n=a%3A3%3A%7Bs%3A3%3A%22oid%22%3Bi%3A1029%3Bs%3A2%3A%22dm%22%3Bs%3A19%3A%22pagelet.mafengwo.cn%22%3Bs%3A2%3A%22ft%22%3Bs%3A19%3A%222019-07-16+22%3A21%3A36%22%3B%7D; __omc_r=; _r=mfwdev; _rp=a%3A2%3A%7Bs%3A1%3A%22p%22%3Bs%3A19%3A%22aos.mfwdev.com%2Fmain%22%3Bs%3A1%3A%22t%22%3Bi%3A1563347224%3B%7D; __jsl_clearance=1563627356.535|0|kk93xnOdc8BeDY9pWeEPqYZ6Hb0%3D; __mfwlv=1563627359; __mfwvn=