navigation
[Deep 01] Execution context [Deep 02] Prototype chain [Deep 03] Inheritance [Deep 04] Event loop [Deep 05] Curri Bias function [Deep 06] Function memory [Deep 07] Implicit conversions and operators [Deep 07] Browser caching mechanism (HTTP caching mechanism) [Deep 08] Front-end security [Deep 09] Deep copy [Deep 10] Debounce Throttle [Deep 10] Front-end routing [Deep 12] Front-end modularization [Deep 13] Observer mode Publish subscribe mode Bidirectional data binding [Deep 14] Canvas [Deep 15] webSocket Webpack HTTP and HTTPS CSS- Interview Handwriting Promise
[react] Hooks
[Deployment 01] Nginx [Deployment 02] Docker deployVue project [Deployment 03] gitlab-CI
[source code – Webpack01 – precompiler] AST abstract syntax tree [source code – Webpack02 – Precompiler] Tapable [source code – Webpack03] hand written webpack-compiler simple compilation process [source code] Redux React-redux01 [source] Axios [source] vuex [source -vue01] Data responsive and initialized rendering [source -vue02] Computed responsive – Initialization, access, update process
Front knowledge
Some words
Permanent: permanently, permanently permanent: temporary: grammarCopy the code
TCP/IP protocol – application layer, transport layer, network layer, data link layer
- Application layer: HTTP, FTP, TELNET, SMTP, DNS and other protocols
- Transport layer: TCP and UDP
- Network layer: IP protocol, ICMP protocol, etc
- Data link layer
Transport layer protocols (TCP and UDP) use network layer protocols (IP protocol) to transmit packets from one network to another
- Think of (IP) as a kind of (highway) that allows other protocols to drive over it and find exits to other computers.
- (TCP and UDP) are on the highway (” trucks “)
- The truck is carrying protocols like HTTP, the file transfer protocol FTP
TCP header Diagram
- conclusion
- Ack = Seq + 1 ———————- Confirmation number = Serial number + 1
- No. Seq (ISN)
- Confirm the Ack number
- Mark:
- SYN Creates a link
- The FIN releases a link
- The Seq number is valid only when ACK is 1
TCP Three-way handshake
Three-way handshake: Three packets sent by the client and server are required to establish a TCP link
- The first handshake
- The client sends a connection packet (flag SYN=1, Seq=x) to the server
- SYN=1: creates a link
- Client status: CLOSED => SYN_SENT
- The client sends a connection packet (flag SYN=1, Seq=x) to the server
- Second handshake
- The server sends a packet (flag SYN=1,ACK=1, Seq=y, ACK= x+1) to the client
- Ack = Seq + 1
(Confirmation number = Serial number + 1)
- Server status: CLOSED => SYN_RCVD status
- Ack = Seq + 1
- The server sends a packet (flag SYN=1,ACK=1, Seq=y, ACK= x+1) to the client
- The third handshake
- The client sends a packet (flag SYN=0,ACK=1, Seq=x+1, ACK= y+1) to the server
- Established: Established
- The client and server are in the ESTABLISHED state
- The client sends a packet (flag SYN=0,ACK=1, Seq=x+1, ACK= y+1) to the server
TCP Establishes a link – why is a third handshake needed
Why is it that only three handshakes can confirm the ability of both parties to send and receive, but not two handshakes?
- The first handshake:
- The client sends the connection packet. The server receives the connection packet
- (server) can conclude :(client sending capability, server receiving capability is normal)
- Second handshake
- The server sends the acknowledgement packet, and the client receives it
- (client) can conclude :(server’s receiving and sending capability, client’s receiving and sending capability is normal)
- Note: At this point, the server cannot confirm whether the client’s reception capability is normal
- The third handshake
- The client sends an acknowledgement packet and the server receives it
- (server) can conclude :(client’s receiving and sending capabilities, and server’s receiving and sending capabilities are normal)
- Summary Why do we need three handshakes:
- In order to achieve reliable data transmission, both TCP communication parties must maintain a serial number to identify which packets have been received by the other party
- The three-way handshake is a necessary step for both parties to inform each other of the start value of the serial number and confirm that the other party has received the start value of the serial number
- If there are only two handshakes, only the starting serial number of the connection initiator can be confirmed, and the serial number selected by the other party cannot be confirmed, which is analyzed in the previous handshake. If there are two handshakes, the server cannot confirm that the reception capability of the client is normal
- Prevent failed connection requests from being passed back to the server, resulting in errors
Four times to wave
- Flag bit: FIN indicates that a link is released
- Note: Both the client and the server can initiate the wave
- Established, established, established
- Procedure :(assuming it was initiated by the client, the flag FIN=1 indicates that the link is released)
- First wave
- The client sends a release packet (flag FIN=1, Seq= U) to the server
- Client status: From ESTABLISHED => FIN_WAIT1
- It indicates that the initiator (client) sends all packets, but the initiator (client) can still receive packets
- Second wave
- The server returns an acknowledgement packet (ACK=1, ACK= U +1, Seq=v) to the client
- The status of the server is ESTABLISHED => COLSE_WAIT
- Third wave
- The server sends a release packet (flag bit FIN=1,ACK=1, ACK= U +1, Seq=w) to the client
- Server status: COLSEWAIT state => LAST_ACK state
- It indicates that the initiator (server) sends all packets, but the initiator (server) can still receive packets
- The fourth wave
- The client sends an acknowledgement packet (ACK=1, ACK= w+1, Seq= U +1) to the server
- Client status: If the client status is FIN_WAIT2 => TIME_WAIT
- Note:
- Usually, the client closes and enters the TIME_WAIT state
- The server is closed passively and does not enter the TIME_WAIT state
TIME_WAIT status – 2MSL status
- The TIME_WAIT state is also called the 2MSL wait state
- Each SPECIFIC TCP implementation must select a Maximum Segment Lifetime (MSL), which is the Maximum duration of any Segment in the network before it is discarded.
Why is the client in TIME_WAIT state after the fourth wave instead of being shut down
- To ensure whether the server has received an Ack acknowledgement packet, that is, no FIN packet has been received from the server within 2MSL, indicating that the SERVER has received an Ack
- If no, the server sends a FIN packet to the client. After receiving the ACK packet again, the client knows that the previous ACK packet is lost and sends the ACK packet again.
- TIME_WAIT Indicates the duration of at least one packet. Generally, a timer is set. If no FIN packet is received after the timer expires, the ACK packet is successfully received and the device is in the CLOSED state.
Some important HTTP status codes
100 the Continue -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the client should Continue to request 101 Switching separate Protocols -- -- -- -- -- -- -- -- -- -- -- -- -- -- Switching protocol, Agreement to upgrade 200 ok -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - the request is normal processing 204 no content -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the request processing is successful, But do not have the resources can return 206 partial content -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- part request resource 301 version permanently -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - a permanent redirect, Need to change the bookmark reference Found 302 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- a temporary redirect 303 set other -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- a temporary redirect, The GET method should be adopted for resources 304 not modified -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - resource has not been modified, Negotiation 307 Temporary Redirect cache -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- a Temporary Redirect 400 bad request -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the wrong 401 unauthorized request -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - authentication failure -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- (unauthorized) 403 who -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the authentication is successful, But permissions not enough -- -- -- -- -- -- -- -- -- -- -- -- -- (permission) enough 404 not found -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- resources not found 405 method not allowed -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- request method error 500 Internal Server Error -- -- -- -- -- -- -- -- -- -- -- -- Server Error 502 Bad Gateway -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Error 503 Gateway Service Unavailable -- -- -- -- -- -- -- -- -- -- -- -- -- -- 504 Gateway server overload Time Out -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- a Gateway timeoutCopy the code
HTTP
The disadvantage of HTTP
- Communication is in plain text (not encrypted) and the content may be eavesdropped
- The identity of the communicating party is not verified, so it is possible to encounter disguise
- The integrity of the message cannot be proved, so it may have been tampered with
HTTP is transmitted in plain text and may be eavesdropped |
- HTTP does not provide encryption and packets are transmitted in plaintext
- Why not encrypt:
- TCP/IP protocol family working mechanism, communication content in all communication lines
It could be peeping. – Even encrypted communications can be picked up, just like unencrypted communications. If the communication is encrypted, the meaning of the message may not be broken, but the encrypted message itself can still be seen
What are the encrypted objects – (Encrypted processing to prevent eavesdropping)
- Encryption of communication lines – Secure communication lines
- Encryption of communication content – Content is at risk of being tampered with
Encryption of communication lines
- HTTP is used in combination with SECURE Socket Layer (SSL) or Transport Layer Security (TLS) to encrypt HTTP communications
Encryption of communication content
- The content is still at risk of being tampered with
HTTP does not authenticate the identities of the communication parties and may be disguised |
- Requests and responses in THE HTTP protocol do not acknowledge the communicating party.
- Whether the server is the actual host specified by the URI in the sending request
- Whether the returned response is actually returned to the client that actually requested it, and so on.
Risks of not verifying the communication between the two parties
- The server that cannot be determined to respond is the target server for the request
- Unable to determine whether the response content was actually sent to the client at the time of the request
- Cannot determine whether the peer you are communicating with has access rights. If important information is held on the Web server, you only want to give specific users access to communication.
- It is impossible to determine where the request came from or from whom
- Even meaningless requests are accepted in full. Denial of Service (DoS) attacks cannot be prevented due to massive requests
- Note: THE HTTP protocol does not identify the communicating party, but SSL does
- SSL not only provides encryption, but also uses a method called a certificate,
Can be used to determine that the party – certificate is issued by a trusted third party to prove that the server and client actually exist
HTTP packets cannot be verified and may be tampered with |
- Completeness refers to the accuracy of information
- The content received may be incorrect
What is a man-in-the-middle attack
- An attack like this in which the request or response is in transit and the attacker intercepts and tampers with the content is called a man-in-the-middle attack
- (Man-in-the-middle Attack, MITM).
Using THE HTTP protocol Indicates the method of confirming packet integrity
- MD5 and SHA-1 hash verification
- And the digital signature method used to validate the file.
HTTP packet = Header + blank line + body
Request header = Request line + request header
Response header = Response line + Response header
- The information used for HTTP protocol interaction is called HTTP packets
- Request packet: Packet sent by the client
- Response packet: Packet sent by the server
- HTTP packet: a string of text composed of multiple lines of data
HTTPS
HTTPS = HTTP + encryption + authentication + integrity protection
- SSL is independent of HTTP, so other application-layer protocols can also use SSL
HTTPS encryption mode – Mixed encryption, that is, symmetric encryption and asymmetric encryption are used together
- HTTPS uses mixed encryption
-
When exchanging keys: Use public encryption – (asymmetric encryption) -
After establishing communication, exchanging messages phase: Using shared encryption – (Symmetric encryption) - The processing speed of asymmetric encryption is slower than that of symmetric encryption, so both have advantages, so HTTPS uses combination encryption
-
Public key encryption – There is no proof that the public key itself is a real public key
A certificate that proves that the public key is identified
-
Problems with public key encryption
- There is no way to prove that a public key is a real public key because it can be replaced during propagation
-
Question: How to solve the public key security of public encryption????? -
Solution: Issued by digital Certificate Authority (public key Certificate)
Business process of digital Certificate Authority
- Pre-knowledge:
- The server has a pair of keys: a public key and a private key
- Certificate authorities also have a pair of keys: a public key and a private key, which are pre-built into the browser
- The certificate authority encrypts (the server’s public key) with (its own private key), performs a digital signature, and generates a public key certificate
The specific process
-
- The server applies for its own (public key) certificate to the CA
-
- The certificate authority digitally signs the server’s (public key) with its own (private key) and generates (Public key certificate)
-
- (Server) sends (Public key certificate) issued by certificate authority to (client)
-
- After receiving the public key certificate, the client uses the built-in (certificate authority’s public key) to decrypt (the public key certificate, to prove the authenticity of the server’s public key).
- Verification by
- Note The public key of the server is issued by a certificate authority
- The public key of the server is trustworthy
-
- If it is a real service’s public key certificate, then it is sent to the server
-
- When the server receives the message, it uses its own private key to decrypt it. After decrypting, the server obtains the symmetric key.
-
- Next, communication can be double-sent (symmetric encrypted communication), that is, communication can be established and messages can be exchanged
-
HTTPS communication process – SSL handshake process
-
Name description:
- Handshake: shake hands
- Certificate: certificate
- Cipher: password
- Suite: a set of
- Cipher Suite: indicates the password component
- Spec: specification
- Exchange exchange:
- ClientKeyExchange
- ChangeCipherSpec: Changes the password specification to use symmetric encryption for communication after exchanging public keys with asymmetric encryption
-
SSL handshake process – Note the combination of authentication and encryption
-
(1) (Client) Starts SSL communication by sending (Client Hello packet)
- The packet contains :(SSL version), (encryption component list)
- List of encryption components The Cipher Suite contains the encryption algorithm and key length
-
(2) The server sends an Erver Hello packet as a response
- The packet also contains :(SSL version), (encryption component list)
- The (server) encryption component content is filtered from the received (client) encryption component
-
(3) (Server) sends (certificate) encrypted packet containing (public key certificate)
-
(4) The Server sends a Server Hello Done packet to notify the client that the initial SSL handshake negotiation is over
-
(5) After the first SSL handshake, a Client Key Exchange packet is sent as a response
- The packet contains the following: Pre-master secret Random password string. The packet is encrypted using the public key certificate in 3
-
(6) (Client) Continue to send (Change Cipher Spec) packets
- The packet prompts the server, and the communication after the packet is encrypted using the pre-master secret key
-
(7) The client sends Finished packets
- The packet contains the overall checksum value of all the packets connected so far
- The success of the handshake negotiation depends on whether the server can decrypt the message correctly
-
(8) (Server) Also sends a Change Cipher Spec message
-
(9) (Server) also sends (Finished) packets
-
(10) After HTTP requests are sent and Finished packets are exchanged between the server and client, the SSL connection is established and the communication is protected by SSL
- From here, application layer communication begins, that is, HTTP requests are sent
-
(11) Respond to HTTP requests
-
(12) The connection is finally disconnected by the client. When the connection is disconnected, the close_NOTIFY packet is sent.
Url to page display process
- DNS domain name resolution // Resolves domain names into IP addresses
- Establishing a TCP connection // Three-way handshake
- The client initiates an HTTP request
- The server processes the request and returns an HTTP packet
- The browser parses the rendered page
- Disconnect the TCP connection // Wave four times
1. DNS domain name resolution - DNS is (Domain name System) short for domain name system - resolve domain names into IP addresses - A domain name corresponds to more than one IP address - Why resolve domain names into IP addresses? - Because (for TCP/IP networks) is determined by (IP address), the message cannot be sent to the other party without knowing the IP address. - DNS The process of domain name resolution: // Query the DNS cache in the browser, and then enter the TCP connection stage. 2. Query DNS cache in (local operating system) 3. Query DNS cache in (local host) file 4. Iteratively query // Root domain name/level-1 domain name/level-2 domain name.... Blog.baidu.com -.com -.baidu.com -.baidu.com -.baidu.com -.baidu.com Browser DNS cache => operating system DNS cache => local host file => router => carrier => None of the above DNS cache, recursively query level-1 / level-2 / level-3 domain name. The role of the questioner is changing, a-> B -> C -> D -> C ->b->a - iterative query: the role of the questioner is always the same, each time the query result is returned to the same questioner, and then iterated until the desired result is found; A ->b->a, a->c->a, a->c->a, a->c->a Initiate a new link, (Synchronize Sequence Numbers) -seq: The sequence number is random - Second handshake - The server sends an acknowledgement packet to the client with the flag bit SYN=1,ACK=1, ACK= x+1, Seq=y - THE ACK bit indicates the response - Third handshake - The client sends one The reason for the third handshake is to avoid the delay of the invalid connection packet sent to the server, causing the server to think that the connection is to establish the false impression, causing error 3. The client sends an HTTP request. 4. The server processes the request and returns an HTTP response packet. The browser parses the rendering - meet HTML tags, the browser calls the HTML parser, which parses into tokens and builds the DOM tree - meet style/link tags, the browser calls the CSS parser, which parses into the CSSOM tree - meet script tags, the browser calls the JS parser, Handling JS code (binding events, DOM tree and CSSOM Tree may be modified) - Merge DOM and CSSOM into Render tree - Calculate layout from Render tree - draw the colors of each node to the screen (paint rendering) - If paint is layered, you need to (composite) 6. Disconnect the TCP connection // Wave four times, (FIN: - First wave: from the browser, telling the server that the request has been sent and you are ready to close - Second wave: from the server, telling the browser that the request has been received and I am ready to close and you are ready to close - Third wave: The server initiates, tells the browser, I've sent the response, you're ready to close - Fourth wave: browser initiates, tells the server, I've received the response, I'm ready to close, you're ready to close - first the server shuts down, then the browser closesCopy the code
The difference between recursive and iterative queries
Differences between TCP and UDP
-
TCP connection-oriented (high reliability), UDP connectionless (low reliability)
The difference between HTTP1.0 and HTTP1.1
HTTP1.0
- Stateless: The server does not track or record the requested status
- Connectionless: The browser must re-establish the link every time it requests it
HTTP1.0 (1) Stateless 1. The server does not keep track of the requested status 2. (2) Connectionless - There are two main types of performance defects caused by connectionless: - No reuse of links - Each time a request is sent, a TCP link, that is, three handshake and four wave, making the network utilization is very low - Header blocking - HTTP1.0 requires that the response to the previous request arrive before the next request can be sent, how the previous request blocked, the following will be blockedCopy the code
HTTP1.1
HTTP1.1 addresses HTTP1.0’s performance flaws
- Persistent connections: The Connection field is added. You can set keep-alive to Keep links open
- Piped: Based on the long connection, piped can send subsequent requests without waiting for the first request response, but the response must be returned in the same order as the request
- Cache processing: added cache-control field
- Note the comparison to Expires in 1.0
- Expires: Is an absolute time point
- Cache-control: specifies a time range and can be set except for max-age
- max-age
- Public All servers cache
- Private Allows only some browsers to cache resources
- The no-cache server does not cache resources, and the source server will no longer confirm the resource validity of the request from the cache server, and it is forbidden to cache the response resources
- Breakpoint continuingly
- Request header (Range)
- Specify (first byte location) and (last byte location)
Range:(unit=first byte pos)-[last byte pos]
Range: bytes=0-801 // Generally requests to download the entire file are bytes=0- or do not use this header
- Response header (Content-range)
- Specifies where to insert a portion of the entire entity, and the length of the entire entity
- When the server returns a portion of the response to the browser, it must describe (the scope of the response) and (the length of the entire entity)
Content-Range: bytes (unit first byte pos) - [last byte pos]/[entity legth]
Content-range: bytes 0-800/801 //801: indicates the total file size
- Request header (Range)
HTTP1.1 (1) Keep-alive - HTTP1.1 keeps keep-alive by default. The data transfer is complete. Keep the TCP Connection open and continue to use this channel for data transfer. Timeout =5, Max =1000 -timeout: specifies the minimum period (in seconds) for which an idle connection must be kept open. -max: Before the connection is closed, Maximum number of requests that can be sent on this connection (2) pipelined-HTTP1.0 - Request 1 > Response 1 -> Request 2 > Response 2 -> Request 3 > Response 3 - HTTP1.1 - Request 1 -> Request 2 -> Request 3 > Response 1 -> Response 2 --> Response 3 -- Although pipelining can send multiple requests at once, the responses are still returned sequentially, (3) Cache handling - New cache-control field in HTTP1.1 - http1.0 => Expires => is an absolute point in time, In GMT time format - HTTP1.1 => cache-control => is a period of time, in seconds - cache-control: No-cache,private,max-age= 121233-no-cache: no strong cache, use negotiation cache A period of time, in seconds. - public: Allows all servers to cache the resource. - Private: Allows all servers to cache the resource. This disables intermediate servers (such as proxy servers) from caching such resources. For files that contain the user's personal information, you can set private-expires and cache-control comparisons -- if both are enabled, Cache-control has a higher priority than Expires is a point in time in GMT time, cache-control is a time period in seconds, Cache-control is more accurate than Expires. (4) Breakpoint continuation - request header: range-response header: Content-range - Principle - When uploading/downloading a resource, if the resource is too large, split it into multiple parts, upload/download separately - If you encounter a network failure, you can continue the request from the already uploaded/downloaded place, do not have to start from scratch, improve efficiency - Case: -Range: bytes=0-801 - Content-Range: bytes 0-800/801Copy the code
HTTP2.0
- Binary framing
- Multiplexing: Sending requests and responses simultaneously while sharing A TCP link
- The head of compression
- Server push: The server can push additional resources to the client without an explicit request from the client
HTTP2.0 (1) Binary framing - divides all transmitted information into smaller messages and frames and encodes them in binary format (2) Multiplexing - based on binary framing - all access is from the same TCP connection under the same domain name, HTTP messages are split into separate frames and sent out of order, The server reassembles the message based on the identifier and the beginningCopy the code
- Disadvantages of HTTP2.0 versus HTTP1.0
- Connection cannot be reused
- The head of the block is blocking
The difference between PUT and POST
- idempotence
PUT is idempotent
That is, one or more consecutive calls have the same effect (no side effects)POST is non-idempotent
- resources
The URI of PUT points to a specific single resource
– Update resourcesPOST can point to a collection of resources
– New Resources
- conclusion
- POST is used to add resources. It is not idempotent, that is, it can be a collection of resources
- PUT is used to modify resources. It is idempotent. Each commit changes the same content to a single resource
The difference between PUT and PATCH
- Both can update resources
- PATCH is a local update of resources. In this way, PATCH will submit one less body size and reduce the packet size
Binary framing
- Advantages of binary framing
- Http1.0 resends the request each time
- Http1.1 cannot resolve the header congestion
- Http2.0 uses (binary framing) to achieve (multiplexing)
- TCP transport
- TCP layer transport is to split (the data of the previous layer protocol) into (multiple packets with different serial numbers) for transmission
- Yes (full-duplex) communication, that is, both parties need to confirm the serial number of the transmitted packet.
- The principle of
- http1.0
- Directly (
The request packet is a character
) to TCP for transmission - In the (
The application layer
) must parse out (Request a head
) and (The request body
) to complete the communication
- Directly (
- http2.0
- Transfer application layer data through (
Binary framing
) will deal with (Different requests are split into different streams
), through (Stream id
), (The requested stream is split into several types of frames, including head and data frames.
), it is the STREAM ID tag and the different types of frames that ensure an orderly reorganization of requests and responses - Binary framing is processed at the (binary frame layer) and (recombination) is also processed at the (binary frame layer)
- Transfer application layer data through (
- http1.0
- Conclusion:
- Http2.0 introduces the binary frame layer, which converts concurrent requests into different streams, each with a specific ID. This ensures that the request and response data can be reassembled by the binary frame layer, even if the transmission is out of order
multiplexing
- 2021/06/18 Multiplexing review
(1) frame and flow
- The frame to frame
- (frame) is the smallest unit of data transmitted in Http2
- Frames are divided into two parts: a headerFrame and a dataFrame.
- A frame contains the following fields: Type Flags Length streamIdentifier framePayload
- Flow stream –
- (Stream) is a virtual channel that http2 exists in a link.
- each
flow
There is aUnique id
, a complete request or response is called aThe data flow
- The characteristics of the flow
- Bidirectional: Data can be sent and received simultaneously within the same stream
- Order: The data passed in the stream is divided into binary frames
- Parallelism: Binary frames in a stream are transmitted in parallel, without waiting in order
- Stream creation and closure: Can be created unilaterally by client and server, and can be unilaterally closed
- The stream ID is odd, indicating that it was initiated by the client, which is standard
- Stream ids are all even, indicating that the stream is initiated by the server
(2) Summary of multiplexing
- Transmission content: http2 uses (binary frame transmission), instead of http1 (text transmission)
- advantages
- (Sequence and blocking) in HTTP2 instead of http1
- All (requests with the same domain name) are completed concurrently through (the same TCP link), which request is distinguished by the unique identifier of each request stream, and reorganized after transmission to the server, so as to achieve concurrent unordered sending
Why is http1.0 not multiplexing?
- Because HTTP1.0 is a string, i.e.
- And -HTTP2.0 is (binary frames)
data
Introduction to HTTP and HTTPS juejin.cn/post/684490… Three handshakes juejin.cn/post/684490… Three handshakes and four waves juejin.cn/post/684490… TCP juejin. Cn/post / 684490… Why do you need three handshakes github.com/jawil/blog/… Four waves juejin.cn/post/684490… URL to page render juejin.cn/post/684490… TCP and UDP: juejin.cn/post/684490… HTTP1.0 HTTP1.1 HTTP2.0 github.com/Advanced-Fr… What is the interviewer asking us about the three handshakes and four waves? Juejin. Cn/post / 684490…