http请求头和相应头的作用

请求头(Request Headers)

Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate
Accept-Language:zh-CN,zh;q=0.8
Connection:keep-alive
Content-Length:26
Content-Type:application/x-www-form-urlencoded
Cookie:SESSION=e66cc5c3-403d-4e9e-b8c4-ad294dec4341
Host:192.168.9.124:38003
Origin:http://192.168.9.125:48000
Referer:http://192.168.9.125:48000/src/pages/index/
User-Agent:Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36
X-Requested-With:XMLHttpRequest

 

响应头(Response Headers)

Content-Length:1938
Content-Type:application/json;charset=UTF-8
Date:Mon, 05 Jun 2017 10:11:03 GMT
X-Application-Context:df-manager:dev:38003

 

http是个无状态的协议,所以,需要在请求头和响应头中包括自身的一些信息和想要执行的动作,这样,对方在收到信息后,就可以知道你是谁,你想干什么。

请求头描述了客户端向服务器发送请求时使用的http协议类型,所使用的编码,以及发送内容的长度,refer,等等。refer干嘛的,一般用来做简单的防跨站攻击。 相应的响应头用来描述服务器回给你对所返回的content的一些一些描述,我是什么服务器,我返回的是啥编码,我返回的内容有多长等等。

posted on 2017-06-05 18:18  CNundefined  阅读(1096)  评论(0编辑  收藏  举报