我是靠谱客的博主 义气芝麻,这篇文章主要介绍HTTP headerHTTP 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.(rn)
  • The end of the header section is indicated by an empty field, resulting in the transmission of two consecutive CR-LF pairs. (rnrn)

HTTP header fields by WIKI

Request(GET) sample

复制代码
1
2
3
4
5
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

复制代码
1
2
3
4
5
6
7
8
9
10
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

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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": [ ] }}

最后

以上就是义气芝麻最近收集整理的关于HTTP headerHTTP header的全部内容,更多相关HTTP内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(61)

评论列表共有 0 条评论

立即
投稿
返回
顶部