HTTP基于TCP协议之上的应用层协议,服务于Web浏览器和Web服务器的通信。是通用的、无状态的面向对象的协议。
Note: 无状态指的是同一个客户端的多次请求没有对应关系。
HTTP header
HTTP headers主要可分为:Request header & Response header
- The header fields are transmitted after the request or response line, which is the first line of a message. (POST /rest/container HTTP/1.1)
- Header fields are colon-separated name-value pairs in clear-text string format, terminated by a carriage return (CR) and line feed (LF) character sequence.(\r\n)
- The end of the header section is indicated by an empty field, resulting in the transmission of two consecutive CR-LF pairs. (\r\n\r\n)
Request(GET) sample
GET https://10.103.201.165/rest/container HTTP/1.1
Host: 10.103.201.165
Accept-Encoding: gzip, deflate
User-Agent: Fiddler
ph-auth-token: S0NPFPd7kcaKbEq3CqTkaNTLRDxVQzUrb20ACmyFBFw=
Request(POST) sample
POST https://10.103.201.165/rest/container HTTP/1.1
Host: 10.103.201.165
Content-Length: 309
Accept-Encoding: gzip, deflate
Accept: */*
User-Agent: Fiddler
Connection: keep-alive
ph-auth-token: S0NPFPd7kcaKbEq3CqTkaNTLRDxVQzUrb20ACmyFBFw=
{"status": "new", "description": "created container via REST", "sensitivity": "red", "data": {}, "severity": "high", "asset_id": 16, "name": "cap", "source_data_identifier": "100001", "label": "incident", "due_time": "2017-03-21T19:29:23.759Z", "start_time": "2016-03-21T19:28:13.759Z", "owner_id": "admin"}
Response sample
HTTP/1.1 200 OK
Server: bfe/1.0.8.14
Date: Thu, 02 Jun 2016 09:30:54 GMT
Content-Type: text/html;charset=utf-8
Connection: keep-alive
Vary: Accept-Encoding
Cache-Control: private
Expires: Thu, 02 Jun 2016 09:30:54 GMT
Set-Cookie: __bsi=12963635977989043210_00_182_N_N_120_0303_C027_N_N_N_0; expires=Thu, 02-Jun-16 09:30:59 GMT; domain=www.baidu.com; path=/
Content-Length: 73
{"errNo":"0","data": { "redDot": [ ], "newWord": [ ], "layer": [ ] }}
网友评论