Computer Fundamentals

Computer network

(1).TCP three-way handshake

1. First handshake: When both ends are CLOSED at first, the Client sets the SYN flag bit to 1, randomly generates a value seq= X, and sends the packet to the Server. The Client enters the SYN-sent state and waits for confirmation from the Server.

2. Second handshake: After receiving the packet, the Server realizes that the Client requests to establish a connection by using flag bit SYN=1. The Server sets flag bit SYN and ACK to 1, ACK =x+1, randomly generates a value seq= Y, and sends the packet to the Client to confirm the connection request. When the Server enters the SYN-RCVD state, the operating system allocates TCP cache and variables for the TCP connection.

3. The third handshake: After receiving the acknowledgement, the Client checks whether the ACK is X +1 and ACK is 1. If the ack bit is correct, the Client sets ack bit to 1 and ACK = Y +1. At this time, the operating system allocates TCP cache and variables for the TCP connection and sends the packet to the Server. Check whether the ACK value is 1. If the ACK value is correct, the connection is ESTABLISHED successfully. The Client and Server enter the ESTABLISHED state and complete the three-way handshake.

Principle of CDN

The full name of CDN is Content Delivery Network. The basic principle of CDN is to widely use a variety of cache servers, distribute these cache servers to the regions or networks where users visit relatively concentrated. When users visit websites, the global load technology is used to point users’ access to the nearest normal cache server, and the cache server responds directly

The DNS

Browser cache: The browser caches DNS records at a certain frequency. Operating system cache: If you can’t find the DNS record you need in the browser cache, look for it in the operating system. Route cache: Routers also have DNS caches. DNS server of an ISP: AN ISP has a dedicated DNS server to respond to DNS query requests. Root server: If the ISP’s DNS server cannot be found, it sends a recursive query to the root server (DNS server first asks the IP address of the root DNS server.

Common HTTP request headers

HTTP headers can be divided into generic headers, request headers, response headers, and entity headers

Head agreement instructions
Accept The content-types of acceptable responses.
Accept-Charset Acceptable character set
Accept-Encoding The encoding of acceptable response content.
Accept-Language List of acceptable response content languages
Accept-Datetime An acceptable time-dependent version of the response content
Authorization Authentication information of the resource to be authenticated in HTTP
Cache-Control Used to specify whether caching is used in the current request/reply.
Connection The type of connection that the client (browser) wants to use preferentially
Cookie An HTTP Cookie Set by the previous server via set-cookie (see below)
Content-Length The length of the request body in base 8
Content-MD5 The binary MD5 hash value (digitally signed) of the content of the request body, the result encoded in Base64
Content-Type MIME type of the request body (for POST and PUT requests)
Date The date and time the message was sent (in the “HTTP date “format defined in RFC 7231)
Expect Indicates that the client is asking the server to perform a specific behavior
From The email address of the user who initiated this request
Host Indicates the domain name of the server and the port number monitored by the server. If the requested port is the standard port (80) of the corresponding service, the port number can be omitted.
If-Match The operation is performed only when the entity provided by the client matches the entity on the server. In methods such as PUT, a resource is updated only if it has not been modified since the last update by a slave user.
If-Modified-Since 304 unmodified is allowed if the corresponding resource has not been modified
If-None-Match Allows 304 Not Modified to be returned if the corresponding content has Not been Modified, referring to hypertext Transfer protocol entity flags
If-Range If the entity has not been modified, the missing one or more parts are returned. Otherwise, return the entire new entity
If-Unmodified-Since A response is sent only if the entity has not been modified since a certain time.
Max-Forwards Limits the number of times the message can be forwarded by the proxy and gateway.
Origin Initiate a request for cross-domain resource sharing (this request requires the server to include an Access-Control-Allow-Origin header in the response to indicate the source that Access Control allows).
Pragma Implementation-specific, these fields can be generated at any time in the request/response chain.
Proxy-Authorization Authentication information used to authenticate the agent.
Range Represents a request for a portion of an entity, byte offset starting at 0.
Referer Represents the previous page visited by the browser, which can be considered to have been brought to the current page by links from previous visits. “Referer” is actually the word “Referrer,” but the RFC misspelled the standard and used it instead.
TE Encoding the way the browser expects to accept transfers: You can use the value in the transfer-encoding response protocol header (and you can also use “Trailers” to say that the browser wants to receive some additional fields after the last block of size 0.
User-Agent The browser identity string
Upgrade Requires that the server be upgraded to a higher version protocol.
Via Tell the server which agent made the request.
Warning A general warning that there may be an error in the entity content body.