HTTP 请求头 响应头 状态码

* 常见的 http请求头

 
请求头 说明
Accept-Charset 用于指定客户端接受的字符集
Accept-Encoding 用于指定可接受的内容编码 e.g. Accept-Encoding: gzip,deflate
Accept-Language 用于指定一种自然语言, e.g. Accept-Language: zh-CN
Host 用于指定被请求资源的Internet主机和端口号, e.g. Host: www.taobao.com
User-Agent 客户端将它的操作系统,浏览器和其他属性告诉服务器
Connection

当前连接是否保持 e.g. Connection: Keep-Alive , Connection: Close

* 常见的http响应头

 
响应头 说明
Server

使用的服务器名称,e.g. Server: Apache/1.3.6(Unix)

Content-Type

发送给接受者的实体正文的媒体内容, e.g. Content-Type: text/html; charset=UTF-8

Content-Encoding 与请求爆头Accept-Encoding对应,告诉浏览器服务端采用的是什么压缩编码

Content-Encoding: gzip

Content-Language 描述了资源所用的自然语言,与Accept-Language对应
Content-Length

指明实体正文的长度,以字节方式存储的十进制数字表示

Keep-Alive 保持连接的时间 e.g. Keep-Alive: timeout-5, max=120

* 常见的HTTP状态码

状态码 说明
200 客户端请求成功
302 临时跳转,跳转的地址通过Location指定
400 客户端请求有语法错误,不能被服务器识别
403 服务器收到请求,但是拒绝提供服务
404 请求的资源不存在
500 服务器发生不可预期的错误

猜你喜欢

转载自blog.csdn.net/fareast_mzh/article/details/81805414