Front-End of HTTP knowledge learning, front-end of http knowledge
Front-End of HTTP knowledge learning
HyperTextTransferProtocol is the most widely used network transmission protocol on the Internet. All WWW files must comply with this standard.
HTTP is a TCP/IP-based communication protocol for data transmission (HTML files, image files, query results, etc ).
How HTTP works
The HTTP protocol works on the client-server architecture. As an HTTP client, the browser sends all requests to the HTTP server, that is, the WEB server, through URLs. The correspondence between URLs and IP addresses is controlled by the domain name resolution system, also known as DNS.
HTTP message structure
HTTP consists of three parts: Status Code, request header, and response body.
HTTP Request Method
HTTP1.0 defines three request methods: GET, POST, and HEAD.
HTTP1.1 adds five request methods: OPTIONS, PUT, DELETE, TRACE, and CONNECT.
Serial number |
Method |
Description |
1 |
GET |
Request the specified page information and return the entity body. |
2 |
HEAD |
Similar to a get request, but the returned response does not contain specific content. It is used to obtain the header. |
3 |
POST |
Submits data to a specified resource for processing (for example, submitting a form or uploading a file ). Data is contained in the request body. POST requests may result in creation of new resources and/or modification of existing resources. |
4 |
PUT |
The data transmitted from the client to the server replaces the content of the specified document. |
5 |
CONNECT |
The HTTP/1.1 protocol is reserved for proxy servers that can change connections to pipelines. |
HTTP status code
When a visitor accesses a webpage, the browser sends a request to the server where the webpage is located. Before the browser receives and displays the webpage, the server on which the webpage is located returns a serverheader containing the HTTP status code to respond to the browser's request.
Common HTTP status codes:
200-request successful
301-resources (web pages, etc.) are permanently transferred to other URLs
404-the requested resource (webpage, etc.) does not exist
500-an internal server error occurs.
HTTP status code category
Category |
Category Description |
1 ** |
Information, the server receives the request, the requester needs to continue the operation |
2 ** |
Operation received and processed |
3 ** |
Redirection. Further operations are required to complete the request. |
4 ** |
Client error. The request contains a syntax error or the request cannot be completed. |
5 ** |
A server error occurs when the server processes the request. |
HTTP status code list
Status Code |
English name of Status Code |
Description |
100 |
Continue |
Continue. The client should continue its request |
101 |
SwitchingProtocols |
Switch protocol. The server switches the protocol according to the client request. You can only switch to a more advanced protocol, for example, to a new HTTP protocol. |
200 |
OK |
The request is successful. It is generally used for GET and POST requests. |
201 |
Created |
Created. The request is successful and a new resource is created. |
202 |
Accepted |
Accepted. Request accepted but not processed |
203 |
Non-AuthoritativeInformation |
Unauthorized information. The request is successful. However, the returned meta information is not on the original server, but a copy. |
204 |
NoContent |
NO content. The server successfully processes the request, but no content is returned. When the webpage is not updated, make sure that the current document is displayed in the browser. |
205 |
ResetContent |
Reset content. After the server is successfully processed, the user terminal (for example, a browser) should reset the document view. You can use this return code to clear the form field of the browser. |
206 |
PartialContent |
Some content. The server successfully processes some GET requests. |
300 |
MultipleChoices |
Multiple options. The requested resource can contain multiple locations, and a list of resource features and addresses can be returned for user terminals (for example, browsers) to select |
301 |
MovedPermanently |
Move permanently. The requested resource has been permanently moved to the new URI. The returned information will include the new URI, And the browser will automatically redirect to the new URI. In the future, any new request should be replaced by a new URI. |
302 |
Found |
Temporarily move. It is similar to 301. However, resources are temporarily moved. The client should continue to use the original URI |
303 |
SeeOther |
View other addresses. It is similar to 301. Use GET and POST requests to view |
304 |
NotModified |
Not modified. The requested resource is not modified. When the server returns this status code, no resources are returned. The client usually caches the accessed resources and provides a header to indicate that the client only wants to return the resources modified after the specified date. |
305 |
UseProxy |
Use a proxy. The requested resource must be accessed through a proxy. |
306 |
Unused |
Discarded HTTP status code |
307 |
TemporaryRedirect |
Temporary redirection. It is similar to 302. Use GET request redirection |
400 |
BadRequest |
The syntax of the client request is incorrect and cannot be understood by the server. |
401 |
Unauthorized |
The request requires the user's identity authentication. |
402 |
PaymentRequired |
Reserved for future use |
403 |
Forbidden |
The server understands the request from the client but rejects the request. |
404 |
NotFound |
The server cannot find resources (web pages) based on client requests ). With this code, the website designer can set the personalized page "the resources you requested cannot be found" |
405 |
MethodNotAllowed |
The method in the client request is forbidden. |
406 |
NotAcceptable |
The server cannot complete the request based on the Content Characteristics of the client request. |
407 |
ProxyAuthenticationRequired |
The request requires proxy authentication, similar to 401, but the requester should use the proxy for authorization |
408 |
RequestTime-out |
The request sent by the server to the client is too long and times out. |
409 |
Conflict |
This code may be returned when the server completes the PUT request of the client. A conflict occurs when the server processes the request. |
410 |
Gone |
The resource requested by the client does not exist. 410 different from 404. If a resource has been permanently deleted before, you can use code 410. website designers can use code 301 to specify a new resource location. |
411 |
LengthRequired |
The server cannot process the request information sent by the client without Content-Length. |
412 |
PreconditionFailed |
The prerequisites for client request information are incorrect. |
413 |
RequestEntityTooLarge |
The request is rejected because the request entity is too large and cannot be processed by the server. To prevent consecutive requests from the client, the server may close the connection. If the server cannot process the request, it will contain a Retry-After response. |
414 |
Request-URITooLarge |
The request URI is too long (the URI is usually a URL) and cannot be processed by the server. |
415 |
UnsupportedMediaType |
The server cannot process the media format attached to the request |
416 |
Requestedrangenotsatisfiable |
The range of client requests is invalid. |
417 |
ExpectationFailed |
The server cannot meet the response CT request header information |
500 |
InternalServerError |
The request cannot be completed due to an internal server error. |
501 |
NotImplemented |
The server does not support the request function and cannot complete the request. |
502 |
BadGateway |
A gateway or proxy server receives an invalid request from the remote server. |
503 |
ServiceUnavailable |
The server cannot process client requests temporarily due to overload or system maintenance. The delay length can be included in the Retry-After header of the server. |
504 |
GatewayTime-out |
The server that acts as a gateway or proxy does not get requests from the remote server in time |
505 |
HTTPVersionnotsupported |
The server cannot complete the processing because it does not support the HTTP protocol version of the request. |
<