1. What are the common HTTP methods?

(1) GET: used to request access to resources identified by the URI (Uniform Resource Identifier), which can be sent to the server through the URL;

(2) POST: Used to transfer information to the server. Its main function is similar to GET, but POST is generally recommended.

(3) PUT: transfers the file. The packet body contains the file content and saves it to the corresponding URI.

(4) HEAD: to obtain the packet HEAD, which is similar to GET but does not return the packet body. It is generally used to verify whether the URI is valid.

(5) DELETE: deletes a file. In contrast to the PUT method, DELETE the file at the corresponding URI position.

(6) OPTIONS: Query HTTP methods supported by the corresponding URI.

2.GET and POST:

(1) POST is safer than GET;

(2) GET request can only carry out URL encoding, while POST supports multiple encoding methods;

(3) For the data type of parameters, GET only accepts ASCII characters, while POST has no restriction;

(4) The size of data submitted by GET (generally 1024 bytes), the amount of data that can be transmitted by POST depends on the server Settings and memory size.

3. The difference between HTTP and HTTPS:

HTTP: HTTP is the most widely used network protocol on the Internet.

HTTPS: a network protocol that uses SSL and HTTP to encrypt transmission and authenticate identities. HTTPS is more secure than HTTP.

(1) The HTTP standard port is 80, and the HTTPS standard port is 443;

(2) In the network model, HTTP works at the application layer, while HTTPS’s secure transport mechanism works at the transport layer;

(3) HTTP cannot be encrypted, whereas HTTPS encrypts the transmitted data;

(4) HTTP requires no certificate, while HTTPS requires an SSL certificate issued by the CA organization Wosign.

4. Common HTTP codes:

200: The request is processed normally. 301: Permanent redirection; 302: Temporary redirection; 403: The requested resource is forbidden to be accessed. 404: The server cannot find the corresponding resource. 503: The server exceeds the maximum load.

5. What does a complete HTTP transaction look like? (URL parsing process)

(1) Domain name resolution;

(2) Establish a connection (three handshakes);

(3) Build the page;

(4) Disconnect (wave hands four times);

6. Differences between TCP and UDP

Transmission Control Protocol (TCP) is a connection-based Protocol. Before sending or receiving data, a reliable connection must be established with the peer party. A TCP connection must be set up three times.

User Data Protocol (UDP) is a Protocol corresponding to TCP. It is a connection-oriented protocol, it does not establish a connection with the other party, but directly sends the packet! UDP is suitable for applications where only a small amount of data is transmitted at a time and reliability is not high

7. The differences between HTTP1.0 and 1.1 and 2.0

1.HTTP1.0 is a time-consuming process in establishing and disconnecting connections, and can severely affect client and server performance.

The pipelining mechanism can transmit multiple HTTP requests and responses over a TCP connection, reducing the cost and latency of establishing and closing connections. HTTP1.1 also adds more response headers and request headers;

The differences between HTTP/1.1 and HTTP/1.0 are as follows:

(1) Cache processing

(2) Bandwidth optimization and the use of network connection

(3) Error notification management

(4) Message sending in the network

(5) Maintenance of Internet addresses

(6) Security and integrity

3.HTTP2.0 offers significant performance improvements over previous protocols

(1) Multiplexing: Multiplexing allows multiple request-response messages to be sent simultaneously over a single HTTP/2 connection;

(2) Binary framing: HTTP/2 adds a binary framing layer between the application layer (HTTP/2) and the transport layer (TCP or UDP). Without changing the semantics, methods, status codes, URIs, and header fields of HTTP/1.x, it solves the performance limitations of HTTP1.1, improves transmission performance, and achieves low latency and high throughput.

(3) head compression

(4) Server push