Home  >  Article  >  Web Front-end  >  Knowledge about http, https, http/2

Knowledge about http, https, http/2

一个新手
一个新手Original
2017-09-23 09:34:102862browse

Before learning http, https, http/2, first sort out the OSI network model, TCP/IP protocol, TCP and UDP and other contents.

1. A brief review of the OSI seven-layer network model

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)

2. TCP/IP protocol

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)

3. TCP and UDP

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.

A simple comparison between TCP and UDP:

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

4. HTTP

http (Hypertext Transfer Protocol) is a protocol commonly used at the application layer. It is based on text transmission content.

Eight request methods

get, post, head, put, delete, trace, options, connect.

http request information structure

  • Request line

  • Request header

  • Blank line

  • Other messages

Status code

  • 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)

5. HTTPS

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.

Features of https:

  • 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)

6. SPDY

Spdy is Google's open network transmission protocol. It is located between the http and ssl layers and can speed up access.

Features of spdy:

  • 1. Can reduce latency

  • 2. Can set request priority

  • 3. Header compression

  • 4. Ensure transmission security based on https

  • 5. Support server push

7. HTTP/2

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).

Features of http/2:

  • New binary format

  • Multiplexing

  • Header compression

  • Support server push

The difference between http/2 and spdy:

  • http/2 supports http transmission, spdy only supports https

  • The header compression algorithms of http/2 and spdy are different

Reference article

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn