请求头
内容 | 说明 | 示例 |
---|---|---|
Accept | 可接受的响应内容类型 | Accept:*/* |
Accept-Charset | 可接受的字符集 | Accept-Charset:utf-8 |
Accept-Encoding | 可接受的响应内容的编码格式 | Accept-Encodingg: zip, deflate, br |
Accept-Language | 可接受的响应内容的语言种类 | Accept-Language:zh-CN |
Cache-Control | 用来指定当前的请求/回复中,是否使用缓存机制 | Cache-Control:no-cache |
Connection | 客户端优先使用的连接类型(是否需要持久连接) | Connection:Keep-Alive (HTTP 1.1默认持久连接) |
Content-Length | 以8进制表示的请求体的字节长度 | Content-Length:122 |
Cookie | 由服务器通过Set-Cookie设置的一个HTTP协议Cookie | Cookie: HMVT=6bcd52f51e9b3dce3… |
Host | 表示服务器的域名以及服务器所监听的端口号;如果所请求的端口是对应的服务的标准端口(80),则端口号可以省略 | Host:cdn2.janshu.io |
Referer | 包含一个URL,用户从该URL代表的页面出发从而访问到当前请求的页面。 | Referer:https://www.jianshu.com/p/28a3de6e09c2 |
User-Agent | 浏览器的类型 | User-Agent:Mozilla/5.0… |
状态码
状态码分类
- 1xx:信息,服务器收到请求,需要请求者继续执行操作
- 2xx:成功,操作被成功接收和处理
- 3xx:重定向,需要进一步的操作以完成请求
- 4xx:客户端错误,请求包含语法错误或无法完成请求
- 5xx:服务器错误,服务器在处理请求的过程中发生了错误
常见状态码
- 200 OK:客户端请求成功
- 400 Bad Request:客户端请求有语法错误,不能被服务器理解
- 401 Unauthorized:请求未经授权,这个状态代码必须和WWW-Authenticate报头域一起使用。
- 403 Forbidden:服务器收到请求,但拒绝提供服务
- 500 Internal Server Error:服务器发生不可预期的错误
- 503 Server Unavailable:服务器当前不能处理客户端的请求,一段时间后可能恢复正常
参考
https://blog.csdn.net/weixin_34018202/article/details/93516123
https://blog.csdn.net/kfanning/article/details/60621181
https://www.cnblogs.com/lauhp/p/8979393.html