GET requests can be cached, POST cannot;
POST is relatively safe, and GET requests are included in the URL
POST can transmit more data through the request body
The URL has a length limit, which will affect the GET request. This length is specified by the browser.
POST requests support more data encoding types and do not limit data types
status code:
3xx redirect
301 Permanent Redirect
302 temporary redirect
303
304 The client has buffered documents and made a conditional request to call the local cache
4xx client
400 Request message error
401 Client attempted unauthorized access to a password-protected page. The response will contain a WWW-Authenticate header, according to which the browser displays the username/password dialog, and then makes the request again after filling in the appropriate Authorization headers.
403 forbidden Request denied
5xx server
500 Server Internal Error
503 The server cannot come out and ask
status code | status information | meaning |
---|---|---|
100 | Continue | The initial request has been accepted, and the client should continue to send the rest of the request. (New in HTTP 1.1) |
101 | Switching Protocols | The server will follow the client's request to convert to another protocol (HTTP 1.1 new) |
200 | OK | Everything works fine, the response documents for GET and POST requests follow. |
201 | Created | The server has created the document and the Location header gives its URL. |
202 | Accepted | The request has been accepted, but processing has not yet completed. |
203 | Non-Authoritative Information | The document has been returned normally, but some response headers may be incorrect because a copy of the document is used (new in HTTP 1.1). |
204 | No Content | Without the new document, the browser should continue to display the original document. This status code is useful if the user periodically refreshes the page and the servlet can determine that the user's document is sufficiently up-to-date. |
205 | Reset Content | There's no new content, but the browser should reset what it's showing. Used to force the browser to clear form inputs (new in HTTP 1.1). |
206 | Partial Content | The client sends a GET request with a Range header and the server completes it (new in HTTP 1.1). |
300 | Multiple Choices | The document requested by the client can be found in multiple locations, which are already listed within the returned document. If the server wants to propose a preference, it should indicate it in the Location response header. |
301 | Moved Permanently | The document requested by the client is elsewhere, the new URL is given in the Location header, and the browser should automatically visit the new URL. |
302 | Found | Similar to 301, but the new URL should be considered a temporary replacement, not a permanent one. Note that the corresponding status message in HTTP 1.0 is "Moved Temporatily". When this status code occurs, the browser can automatically access the new URL, so it is a useful status code. Note that this status code can sometimes be used instead of 301. For example, if the browser incorrectly requests http://host/~user (missing the trailing slash), some servers will return 301, while others will return 302. Strictly speaking, we can only assume that the browser will automatically redirect only if the original request was a GET. See 307. |
303 | See Other | Similar to 301/302, except that if the original request was a POST, the redirect target document specified by the Location header should be fetched via GET (new in HTTP 1.1). |
304 | Not Modified | The client has buffered documents and makes a conditional request (usually providing an If-Modified-Since header indicating that the client only wants documents newer than the specified date). The server tells the client that the original buffered document can still be used. |
305 | Use Proxy | The document requested by the client SHOULD be fetched through the proxy server indicated by the Location header (new in HTTP 1.1). |
307 | Temporary Redirect | 和302 (Found)相同。许多浏览器会错误地响应302应答进行重定向,即使原来的请求是POST,即使它实际上只能在POST请求的应答是303时才能重定 向。由于这个原因,HTTP 1.1新增了307,以便更加清除地区分几个状态代码:当出现303应答时,浏览器可以跟随重定向的GET和POST请求;如果是307应答,则浏览器只 能跟随对GET请求的重定向。(HTTP 1.1新) |
400 | Bad Request | 请求出现语法错误。 |
401 | Unauthorized | 客户试图未经授权访问受密码保护的页面。应答中会包含一个WWW-Authenticate头,浏览器据此显示用户名字/密码对话框,然后在填 写合适的Authorization头后再次发出请求。 |
403 | Forbidden | 资源不可用。服务器理解客户的请求,但拒绝处理它。通常由于服务器上文件或目录的权限设置导致。 |
404 | Not Found | 无法找到指定位置的资源。这也是一个常用的应答。 |
405 | Method Not Allowed | 请求方法(GET、POST、HEAD、DELETE、PUT、TRACE等)对指定的资源不适用。(HTTP 1.1新) |
406 | Not Acceptable | 指定的资源已经找到,但它的MIME类型和客户在Accpet头中所指定的不兼容(HTTP 1.1新)。 |
407 | Proxy Authentication Required | 类似于401,表示客户必须先经过代理服务器的授权。(HTTP 1.1新) |
408 | Request Timeout | 在服务器许可的等待时间内,客户一直没有发出任何请求。客户可以在以后重复同一请求。(HTTP 1.1新) |
409 | Conflict | 通常和PUT请求有关。由于请求和资源的当前状态相冲突,因此请求不能成功。(HTTP 1.1新) |
410 | Gone | 所请求的文档已经不再可用,而且服务器不知道应该重定向到哪一个地址。它和404的不同在于,返回407表示文档永久地离开了指定的位置,而 404表示由于未知的原因文档不可用。(HTTP 1.1新) |
411 | Length Required | 服务器不能处理请求,除非客户发送一个Content-Length头。(HTTP 1.1新) |
412 | Precondition Failed | 请求头中指定的一些前提条件失败(HTTP 1.1新)。 |
413 | Request Entity Too Large | 目标文档的大小超过服务器当前愿意处理的大小。如果服务器认为自己能够稍后再处理该请求,则应该提供一个Retry-After头(HTTP 1.1新)。 |
414 | Request URI Too Long | URI太长(HTTP 1.1新)。 |
416 | Requested Range Not Satisfiable | 服务器不能满足客户在请求中指定的Range头。(HTTP 1.1新) |
500 | Internal Server Error | 服务器遇到了意料不到的情况,不能完成客户的请求。 |
501 | Not Implemented | 服务器不支持实现请求所需要的功能。例如,客户发出了一个服务器不支持的PUT请求。 |
502 | Bad Gateway | 服务器作为网关或者代理时,为了完成请求访问下一个服务器,但该服务器返回了非法的应答。 |
503 | Service Unavailable | 服务器由于维护或者负载过重未能应答。例如,Servlet可能在数据库连接池已满的情况下返回503。服务器返回503时可以提供一个 Retry-After头。 |
504 | Gateway Timeout | 由作为代理或网关的服务器使用,表示不能及时地从远程服务器获得应答。(HTTP 1.1新) |
505 | HTTP Version Not Supported | 服务器不支持请求中所指明的HTTP版本。(HTTP 1.1新) |