Home>Article>Web Front-end> How to get HTTP status messages

How to get HTTP status messages

坏嘻嘻
坏嘻嘻 Original
2018-09-14 14:18:34 1933browse

Anyone who has done Socket programming in HTTP request style knows that when we design a communication protocol, the "message header/message body" separation method is very commonly used. The message header tells the other party what the message is for, and the message body Tell the other person what to do.

When the browser requests services from the web server, errors may occur. It is possible to return the following series of status messages:

1xx: Message

Message: describe:
100 Continue The server receives only part of the request, but once the server does not reject the request, the client should continue to send the remaining requests.
101 Switching Protocols Server conversion protocol: The server will comply with the client's request and convert to another protocol.

2xx: Success

Message: describe:
200 OK Request successful (followed by response documents to GET and POST requests.)
201 Created The request is created and new resources are created.
202 Accepted The request for processing has been accepted, but processing is not completed.
203 Non-authoritative Information The document has been returned normally, but some response headers may be incorrect because a copy of the document was used.
204 No Content No new documents. The browser should continue to display the original document. This status code is useful if the user refreshes the page regularly and the servlet can determine that the user's document is current enough.
205 Reset Content No new documents. But the browser should reset what it displays. Used to force the browser to clear form input content.
206 Partial Content The client sent a GET request with a Range header and the server completed it.

3xx: Redirect

Message: describe:
300 Multiple Choices Multiple selections. Linked list. Users can select a link to reach their destination. A maximum of five addresses are allowed.
301 Moved Permanently The requested page has been moved to the new url.
302 Found The requested page has been temporarily moved to the new URL.
303 See Other The requested page can be found under another URL.
304 Not Modified The document was not modified as expected. The client has a buffered document and makes a conditional request (usually by providing an If-Modified-Since header to indicate that the client only wants documents that are newer than the specified date). The server tells the client that the original buffered document can continue to be used.
305 Use Proxy Documents requested by the client should be retrieved through the proxy server specified by the Location header.
306Unused This code was used in the previous version. It is no longer in use, but the code is still retained.
307 Temporary Redirect The requested page has been temporarily moved to the new URL.

4xx: Client error

Message: describe:
400 Bad Request The server failed to understand the request.
401 Unauthorized The requested page requires a username and password.
402 Payment Required This code is not available yet.
403 Forbidden Access to the requested page is prohibited.
404 Not Found The server cannot find the requested page.
405 Method Not Allowed The method specified in the request is not allowed.
406 Not Acceptable The response generated by the server was not acceptable to the client.
407 Proxy Authentication Required Users must first authenticate using a proxy server so that the request will be processed.
408 Request Timeout The request exceeded the server's waiting time.
409 Conflict The request could not be completed due to a conflict.
410 Gone The requested page is unavailable.
411 Length Required "Content-Length" is not defined. Without this content, the server will not accept the request.
412 Precondition Failed The precondition in the request was evaluated as failed by the server.
413 Request Entity Too Large The server will not accept the request because the requested entity is too large.
414 Request-url Too Long The server will not accept the request because the url is too long. This happens when a POST request is converted into a GET request with very long query information.
415 Unsupported Media Type The server will not accept the request because the media type is not supported.
416 The server cannot satisfy the Range header specified by the client in the request.
417 Expectation Failed

5xx: Server Error

Message: describe:
500 Internal Server Error The request is not completed. The server encountered an unpredictable situation.
501 Not Implemented The request is not completed. The server does not support the requested functionality.
502 Bad Gateway The request is not completed. The server received an invalid response from the upstream server.
503 Service Unavailable The request is not completed. The server is temporarily overloaded or down.
504 Gateway Timeout Gateway timeout.
505 HTTP Version Not Supported The server does not support the HTTP protocol version specified in the request.

Related recommendations:

HTTP preliminary annotation-Yitoem

PHP Modify HTTP header-Modify HTTP Headers


The above is the detailed content of How to get HTTP status messages. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn