HTTP protocol
Hypertext transfer protocol, here you need to understand a concept what is a transfer protocol
Transmission protocol: when the client and server communicate, the format of the transmission data is standardized
As a hypertext transfer protocol, it is currently the most widely used network protocol on the Internet.
Features
- Advanced protocol based on TCP/IP
- Default port number: 80
- Based on the request/response model: one request corresponds to one response
- Stateless: each request is independent of each other and cannot exchange data
Common status codes
1XX: Server receiving is not completed, return 1XX status code
2XX: indicates success
200: the client and server process successfully
3XX: the client needs further operations to complete
304: cache
302: redirect
4XX: client error
404: resource not found
405: method not found
5XX: server error
500: The server code is wrong
The difference between get and post requests
- get request
- Get data from the server
- The size of the parameters carried is limited, 4K
- Not safe
- The get method can only support ASCII characters, and the Chinese characters transmitted to the server may be garbled.
- post request
- Send data to the server
- There is no limit to the size of the parameters
- Safety
- Post supports the standard character set and can correctly transmit Chinese characters.
What is the difference between request forwarding and redirection in http?
- Request forwarding
1. Server behavior
2. The address bar has not changed
3. Forwarding is a request
4. Forwarding can only jump to internal resources
-
Redirect
1. Client behavior
2. Address bar will change3. The redirection is a second request
4. Redirection can jump to any resource
http和tcp
http: short connection, stateless, irrelevant language.
tcp: long connection, stateful, related language.
udp and tcp
- UDP
- no connection
- The size of each datagram is within 64K
- Unreliable agreement
- No need to establish a connection, fast
- TCP
- Long connection, forming a channel for data transmission
- Mass data transfer in the connection
- Reliable agreement
- Three handshake to complete the connection, low efficiency