HTTP协议手记

HTTP样例

百度首页HTTP截图

HTTP协议手记_第1张图片

文本内容

【General】
Request URL:https://www.baidu.com/
Request Method:GET
Status Code:200 OK
Remote Address:180.97.33.108:443
Referrer Policy:no-referrer-when-downgrade

【Response Headers】
HTTP/1.1 200 OK
Bdpagetype: 2
Bdqid: 0x8fa7bb3500004f74
Bduserid: 523437610
Cache-Control: private
Connection: Keep-Alive
Content-Encoding: gzip
Content-Type: text/html;charset=utf-8
Date: Wed, 29 Nov 2017 07:52:45 GMT
Expires: Wed, 29 Nov 2017 07:52:45 GMT
Server: BWS/1.1
Set-Cookie: BDSVRTM=58; path=/
Set-Cookie: BD_HOME=1; path=/
Set-Cookie: H_PS_PSSID=1442_21106_25227_25178_25147; path=/; domain=.baidu.com
Strict-Transport-Security: max-age=172800
X-Ua-Compatible: IE=Edge,chrome=1
Transfer-Encoding: chunked

【Request Headers】
GET / HTTP/1.1
Host: www.baidu.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.8,en;q=0.6
Cookie: BAIDUID=69548307031995978B036ABA2139E710:FG=1; PSTM=1510451284; BIDUPSID=B9A66E542C0E63AC53E02AAA68ABB44E; BDUSS=V2cUtOcm5MZDBUclFVNUNmWn5QQlE2bkMxLTBGbjVoemR-c2QtZ1A5d2s0RGxhQVFBQUFBJCQAAAAAAAAAAAEAAAAqBjMf2LzM0tChsNdlcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACRTElokUxJafl; pgv_pvi=6490575872; pgv_si=s1857975296; cflag=15%3A3; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; BD_CK_SAM=1; PSINO=3; H_PS_645EC=a04cL4Vvf9wD8Mij5bL761iV5sWVAh7LU0MXNcH43TmfXPEv3eGusoQaNv2xIzCa2yGA; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; BD_HOME=1; H_PS_PSSID=1442_21106_25227_25178_25147; BD_UPN=12314353; sug=3; sugstore=0; ORIGIN=2; bdime=0

【Query String Parameters】
name=xxx

General

Request URL : 请求的(资源所在服务器)域名地址
Request Method : 请求的提交方式 ,可选值有: GET POST PUT DELETE OPTIONS TRACE LOCK MKCOL MOVE 其中主要的,也最常用的是GET和POST
Status Code : 返回的请求状态码,可选值在100-600之间,各有不同含义,参考百度百科。其中开发最常见的有 200 201 301 302 400 401 403 404 406 407 415 500 501 502 503 这些状态码及其含义必须烂熟于心。其它状态码也经常遇到,但相比这些状态码遇见频率稍低。
Remote Address : 请求的(资源所在服务器)IP地址180.97.33.108:443
Referrer Policy : 资源引用路径,详细概念参考如下博客

Response Headers

HTTP/1.1 200 OK HTTP协议的版本及状态码
Bdpagetype: 2
Bdqid: 0x8fa7bb3500004f74
Bduserid: 523437610
Cache-Control: private
Connection: Keep-Alive
Content-Encoding: gzip
Content-Type : 发送端(客户端|服务器)发送的实体数据的数据类型,详细字段参考这里
其中开发最常见的我自己分为两大类:文本类型和文件类型。
【文本类型】包括xml json text
【文件类型】常见的文件有音频、视频、图片等
这里不一一列出(其实是看了都熟悉,好像都很常用,不知道写啥了)
Date: Wed, 29 Nov 2017 07:52:45 GMT
Expires: Wed, 29 Nov 2017 07:52:45 GMT
Server: BWS/1.1
Set-Cookie: BDSVRTM=58; path=/
Set-Cookie: BD_HOME=1; path=/
Set-Cookie: H_PS_PSSID=1442_21106_25227_25178_25147; path=/; domain=.baidu.com
Strict-Transport-Security: max-age=172800
X-Ua-Compatible: IE=Edge,chrome=1
Transfer-Encoding: chunked

Request Headers

GET / HTTP/1.1
Host: www.baidu.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Upgrade-Insecure-Requests: 1
Accept : 发送端(客户端)希望接受的数据类型text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
Accept-Encoding : gzip, deflate, br
Accept-Language : zh-CN,zh;q=0.8,en;q=0.6
Cookie : BAIDUID=69548307031995978B036ABA2139E710:FG=1; PSTM=1510451284; BIDUPSID=B9A66E542C0E63AC53E02AAA68ABB44E; BDUSS=V2cUtOcm5MZDBUclFVNUNmWn5QQlE2bkMxLTBGbjVoemR-c2QtZ1A5d2s0RGxhQVFBQUFBJCQAAAAAAAAAAAEAAAAqBjMf2LzM0tChsNdlcgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACRTElokUxJafl; pgv_pvi=6490575872; pgv_si=s1857975296; cflag=15%3A3; BDRCVFR[feWj1Vr5u3D]=I67x6TjHwwYf0; BD_CK_SAM=1; PSINO=3; H_PS_645EC=a04cL4Vvf9wD8Mij5bL761iV5sWVAh7LU0MXNcH43TmfXPEv3eGusoQaNv2xIzCa2yGA; BDORZ=B490B5EBF6F3CD402E515D22BCDA1598; BD_HOME=1; H_PS_PSSID=1442_21106_25227_25178_25147; BD_UPN=12314353; sug=3; sugstore=0; ORIGIN=2; bdime=0

其中Accept 和ContentType比较容易混淆,可以多查阅其它资料,如:
这篇博客 的介绍,作用都理解清楚了就不容易混淆了

其它

写的不尽详细,中途参考了一些其它资料:《图解HTTP》。
主要是对经常用但自己记得不太清的东西做一些笔记,也为一些刚学ajax的人提供一些简单参考。
jquery 的ajax请求中常见的参数主要有(括号中为对应的HTTP字段属性):
type(Request Method)
url(Request URL)
dataType(accept)
contentType (contentType)
data (Query String Parameters)

你可能感兴趣的:(操作系统,java,前端)