HTTP header

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)

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": [  ] }}
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 个人博客迁移 在用curl发送http请求的时候发现,自定义添加的header头会被特殊处理,比如 发送x-rea...
    brightwang阅读 937评论 0 1
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 136,665评论 19 139
  • HTTP 超文本传输协议(HTTP,HyperText Transfer Protocol)是互联网上应用最为广泛...
    JimLong阅读 2,098评论 0 2
  • 我喜欢长长久久的东西,也喜欢变化。长久的是一个远期的梦想或者目标,变化的是希望自己在不断前行、进步。我会为一个技术...
    韩相谊阅读 319评论 0 0
  • 一田田田阅读 263评论 0 0

友情链接更多精彩内容