Home  >  Article  >  Web Front-end  >  The main features of the http protocol and the meanings of different status codes

The main features of the http protocol and the meanings of different status codes

yulia
yuliaOriginal
2018-09-08 18:02:342430browse

Main features of http protocol:

Main features: simple, fast, flexible, no connection (non-keep-alive), stateless
1. Each resource URI is Fixed, if you want to access a certain resource, just enter the URI in the browser.
2. Flexible: HTTP allows the transmission of any type of data object, and the type being transmitted is marked by Content-Type.
3. No connection: The meaning of no connection is to limit each connection to only process one request. After the server processes the client's request and receives the client's response, it disconnects. This method saves transmission time.
4. Stateless: means that the protocol has no memory ability for transaction processing. When subsequent processing requires the previous information, it must be retransmitted.

[Supplement] What is a URI? What is a URL? What is the difference?
Brief summary:
URI--Uniform Resource Identifier
URL (Uniform Resource Locator): Uniform Resource Locator is sometimes also commonly known as web page address.
URL is a subset of URI

The main features of the http protocol and the meanings of different status codes

HTTP method

POST: Transfer entity content resource
GET: Get Resources
PUT: Update resources
HEAD: Get the message header
DELET: Delete the file

[Test point: What is the difference between POST and GET? ] (Remember 3-5)

GET is harmless when the browser rolls back, while POST will submit the request again.
The URL address generated by GET can be Bookmarked, but POST cannot.
GET requests will be actively cached by the browser, but POST will not unless manually set.
The GET request parameters will be completely retained in the browser history, while the parameters in POST will not be retained.​
The parameters transmitted in the URL in the GET request are limited in length (2kb will vary in different browsers), while the POST does not.
Regarding the data type of parameters, GET only accepts ASCII characters, while POST has no restrictions.
GET is less secure than POST because the parameters are directly exposed on the URL, so it cannot be used to pass sensitive information.
GET parameters are passed through the URL, and POST is placed in the Request body.
GET requests can only be url encoded -- encodeURIComponent(), while POST supports multiple encoding methods.

[Supplement] The format of POST data is the same as the query string format. If you need to serialize the data of the form in the page and then send it to the server through XHR, you can use the serialize() function to create this character String, that is, form serialization
       
HTTP status code

You need to remember some frequently encountered ones. For other status codes, please refer to the HTTP status code document
1xx : Indication information, the request is being processed
2xx: Request received normally
200: ok
206: "Partial Content" response: The client sent a Get request with a Range request header to indicate itself Only the resources on the url are needed and the server does it. For example: when video audio plays a large video/audio address, it will generally return 206
3xx: Redirection requires additional operations to complete the request
301: Permanent redirection, the requested page has been transferred to New URL
302: Temporary redirection
304: Cache, the server tells the browser to use the cache directly without requesting the server
4xx (client error)
400: Client syntax error
#401: Request authorization failed
403: Request is not allowed Forbidden resource is not allowed to be accessed
404: File, query or URL not found
5xx (server-side error)
500: Server is unpredictable Error
501: "Internal Server Error" An error occurred on the server side when executing the request. The server is not working properly at this time.
503: The server is currently unable to handle the client's request. Temporary overload and crash
504: Server not connected
505: The server does not support or refuses to support the HTTP version specified in the request header

The above is the detailed content of The main features of the http protocol and the meanings of different status codes. 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