# 请求方法与返回状态码

## 请求方法

* GET
* POST
* HEAD - 返回header信息
* PUT
* DELETE
* TRACE 诊断网络
* OPTIONS
* CONNECT

## 返回状态码

* 100-199：参考信息
* 200-299：成功
* 300-399：重定向
* 400-499：客户端错误
* 500-599：服务器错误

具体:

100 - Continue 继续

101 - Switching Protocols 切换协议

200 - OK (**一切 OK**)

201 - Created 已创建,通常伴随 Location header 返回

202 - Accepted 已接受 ,通常表示 PUT 创建资源的请求已接受，但并不一定已创建完毕。

203 - Non-Authoritative Information, 成功处理请求，但需要以另一个资源返回结果。

204 - No Content,已成功处理请求，但没有响应内容。按HTTP规范，浏览器收到此响应时不应更新当前页面显示内容

205 Reset Content,已成功处理请求，但没有响应内容。浏览器收到此响应时应更新当前页面显示内容，即刷新

206 Partial Content,片段内容

300 Multiple Choices,多个选择,如返回不同格式的视频，选择项可在响应内容中列出

301 Moved Permanently,已永久移动到其他位置,配合Location使用。SEO 适用,无结尾/请求目录时也会自动产生此响应

302 Found ,找到了,按HTTP规范，客户端此时应使用和导致产生此响应的请求方法同样的方法再次请求 Location 指定位置的资源;但实践中，绝大多数浏览器都一律使用 GET 请求 Location 中指定的资源。而这一行为却是HTTP规范中 303 See Other 要求的处理方式。

303 See Other,去看另一个;无论导致产生此响应的请求方法是什么，都用GET重新请求 Location 指定位置的资源

304 Not Modified,未修改，无变动（用缓存中的吧）

305 Use Proxy,需要用代理服务器;告知浏览器要用 Location 中指定的代理服务器访问。大部分浏览器不支持。

306 Switch Proxy,已废弃。

307 Temporary Redirect,临时重定向;用同样的请求方法（GET/POST/HEAD...）重新请求Location指定的内容，而不是只用GET。用于弥补 302 在使用实践中的错误。

400 Bad Request,请求错误。

401 Unauthorized.未被授权,`WWW-Authenticate: Basic,`浏览器收到此响应会弹出一个输入用户名、密码的对话框

402 Payment Required,需要付款,实践中很少使用

403 Forbidden,禁止访问;验证失败或充实次数过多也会导致出现此响应。

404 Not Found

405 Method Not Allowed,访问方法不对.服务器禁止以所请求的方法访问，同时一般会通过 Allow 告知允许的方法：Allow: GET, POST, HEAD

406 Not Acceptable,无法接受,当请求中的 Accept系列header中列出的条件无法满足时，会产生此响应。

407 Proxy Authentication Required,代理服务器需身份验证

408 Request timeout,请求超时,服务器一直没遇到 Connection: close ，会产生此响应并关闭连接

409 Conflict,冲突,例如两个用户同时提交PUT请求时

410 Gone,资源曾经存在，但现在已不复存在

411 Length Required,需要提供内容长度,Content-Length.

412 Precondition Failed,前置条件不足,常用于响应PUT请求，避免出现修改时内容已发生变动而被覆盖的情况。

413 Request Entity Too Large,请求实体太大

414 Request-URI Too Long,请求URL太长

415 Unsupported Media Type,不支持的媒体类型，如上传了一个不支持的文件类型

416 Request Range Not Satisfiable,Range 请求片段无法满足

417 Expectation Failed,Expect 请求无法满足

500 Internal Server Error,服务器错误

501 Not Implemented,请求的方法或功能未实现

502 Bad Gateway,网关错误。代理服务器从上游服务器收到一个无效响应时，会给客户端返回此响应

503 Service Unavailable,服务暂不可用。如上游服务器超载或暂时停机维护等，代理服务器则返回此响应。可附带 Retry-After 头。

504 Gateway Timeout,网关超时。代理服务器无法在限定时间内从上游服务器收到一个有效响应

505 HTTP Version Not Supported,HTTP 版本不支持


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://phper.shujuwajue.com/http-xie-yi/qing-qiu-fang-fa-yu-fan-hui-zhuang-tai-ma.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
