HTTP header

HTTP基於TCP協議之上的應用層協議,服務於Web瀏覽器和Web服務器的通信。是通用的、無狀態的面向對象的協議。

PS: 無狀態指的是同一個客戶端的多次請求沒有對應關係。

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)

HTTP header fields by WIKI

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": [  ] }}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章