Home > Article > Web Front-end > Knowledge about http, https, http/2
Before learning http, https, http/2, first sort out the OSI network model, TCP/IP protocol, TCP and UDP and other contents.
OSI is an open communication system interconnection reference model and a protocol specification proposed by the International Organization for Standardization. The model from top to bottom is:
Application layer (OSI application layer protocols include File Transfer, Access and Management Protocol (FTAM), as well as File Virtual Terminal Protocol (VIP) and Public Management System Information (CMIP))
Presentation layer (the presentation layer provides multiple functions for encoding and converting application layer data to ensure that information sent by one system application layer can be used by another A system application layer identification)
Session layer (the session layer establishes, manages and terminates communication sessions between the presentation layer and entities)
Transport layer (the transport layer provides reliable end-to-end network data flow services to higher layers)
Network layer (the network layer is responsible for establishing connections between sources and destinations)
Data link layer (data link layer provides data transmission through physical network links. Different data link layers define different network and protocol characteristics, including physical addressing, network topology, Error checking, data frame sequence and flow control)
Physical layer (the physical layer is responsible for finally encoding the information into current pulses or other signals for network transmission)
The TCP/IP protocol integrates multiple protocols such as TCP and IP to handle the transmission between the computer and the network. It refers to and integrates the OSI network model. The common TCP/IP protocol is divided into four layers, from top to bottom:
Application layer (the application layer corresponds to the application layer and presentation layer of the OSI seven-layer reference model)
Transport layer (the transport layer corresponds to the transport layer of the OSI seven-layer reference model, which provides two end-to-end communication services)
Network Intermediate layer (this layer includes IP protocol, RIP protocol (Routing Information Protocol, Routing Information Protocol), and is responsible for data packaging, addressing and routing. It also includes the Internet Control Message Protocol (ICMP) for Provide network diagnostic information)
Network interface layer (The network interface layer includes protocols for coordinating the transmission of IP data over existing network media)
TCP (Transmission Control Protocol, Transmission Control Protocol)
is a connection-oriented, reliable, byte stream-based transport layer communication protocol. UDP (User Datagram Protocol) is a simple datagram-oriented transport layer protocol. They are responsible for the processing of the transport layer in the OSI network model.
TCP | UDP |
---|---|
Connection-oriented (three-way handshake, four-way wave) | No connection |
Uses more resources | Reduced resource usage |
Ensure data order | No data order |
Slower transmission speed | Transmission Fast speed |
Ensure data correctness | Easily lose packets |
Stream mode | Message mode |
http (Hypertext Transfer Protocol) is a protocol commonly used at the application layer. It is based on text transmission content.
get, post, head, put, delete, trace, options, connect.
Request line
Request header
Blank line
Other messages
1xx Message - The request has been processed by the server Receive, continue processing
2xx Success - the request has been successfully received, understood, and accepted by the server
3xx Redirect - follow-up required operation to complete this request
4xx Request error - the request contains a lexical error or cannot be executed
5xx Server error - the server is in An error occurred while processing a correct request
Common status codes 200 (request successful), 302 (redirected to some url), 304 (read cache), 404 (not found) file or directory), 405 (the method specified in the request is wrong), 500 (server error), 502 (server invalid response)
https can be called the http secure version, mainly SSL (Secure Socket Layer) or TSL (Transport Layer Security) is added under http, and SSL or TSL encrypts the data at the transport layer.
1. Ensure the security of transmitted information (encrypted)
2. Need to apply for a certificate
3. Can prevent operator hijacking
4. Due to the added security layer, the access speed is slowed down
5. HTTP websites can access https links, but https websites cannot access http links (except for some browsers that support mixed-content)
Spdy is Google's open network transmission protocol. It is located between the http and ssl layers and can speed up access.
1. Can reduce latency
2. Can set request priority
3. Header compression
4. Ensure transmission security based on https
5. Support server push
http/2 (Hypertext Transfer Protocol Second Edition), he made some upgrades to http, and also referred to spdy-related content (Can be called an evolved version of spdy).
New binary format
Multiplexing
Header compression
Support server push
http/2 supports http transmission, spdy only supports https
The header compression algorithms of http/2 and spdy are different
The difference between TCP and UDP
Some things you should know about HTTP, HTTP2.0, SPDY, HTTPS
In-depth explanation - Seven-layer network model &&network data packet
The above is the detailed content of Knowledge about http, https, http/2. For more information, please follow other related articles on the PHP Chinese website!