Illustrated HTTP – Book Sharing (1)

Time:2021-5-1

Illustrated HTTP - Book Sharing (1)

The first chapter is about web and network foundation

1.1 using HTTP to access the web

1.2 the birth of HTTP

1.3 network foundation TCP / IP

  • TCP / IP protocol family
  • The commonly used network is based on the TCP / IP protocol family. HTTP is an internal subset.
1.3.1 TCP / IP protocol family
  • Protocol: computer and network equipment to communicate with each other, both sides must be based on the same method. For example, how to detect the communication target, which side initiates the communication, which language to use for communication, and how to end the communication. The communication between different hardware and different operating systems must follow a rule, which is protocol
  • TCP / IP is the general name of all kinds of Internet related protocols
  • Including protocols: TCP, IP, HTTP, FTP, UDP, DNS, etc
1.3.2 layered management of TCP / IP
  • There are four layers: application layer, transmission layer, network layer and data link layer
  • Advantages of layering:
  1. Each layer can be independent of each other. A layer can use the services provided by its lower layer without knowing how the services are implemented
  2. Good flexibility, when a layer changes, as long as its interface relationship remains unchanged, the application above or below this layer will not be affected
  3. Structurally, each layer can choose the most appropriate technology to achieve decoupling
  4. It is easy to implement and maintain, because it can be debugged hierarchically, fast and convenient
  5. It can promote standardization and create a better Internet environment
  • application layer

Function: the application layer determines the communication activities when providing application services to users.
Including: FTP (File Transfer Protocol), DNS (domain name system), HTTP (Hypertext Transfer Protocol)
HTTP protocol is in the application layer

  • Transport layer

Function: the transport layer provides data transmission between two computers in the network connection to the upper application layer
Including: TCP (transmission control protocol), UDP (User Datagram Protocol)

  • Network layer (or network interconnection layer)

Function: the network layer is used to process the data packets flowing on the network. The layer specifies the path (transmission line) to reach the computer of the other party and transmit the data packets to the other party.

  • Link layer (or data link layer or network interface layer)

Function: used to deal with the hardware part of the network, including the operating system, hardware device driver, network card, optical fiber and other physical visible parts.

1.3.3 TCP / IP communication transport flow

Illustrated HTTP - Book Sharing (1)

  • Using TCP / IP protocol family for network communication, it will communicate with each other through hierarchical order
  • The sender goes down from the application layer and the receiver goes up from the network layer
  • technological process
  1. First, as the sender, the clientApplication layer (HTTP protocol)Send an HTTP request
  2. For the convenience of transmission, theTransport layer (TCP protocol)The data received from the application layer (HTTP request message) is divided, and each message is marked with serial number and port number, and then forwarded to the network layer
  3. stayNetwork layer (IP Protocol)After adding the MAC address as the communication destination, forward it to the link layer. Here, the communication request to send the network is ready
  4. The server at the receiving end receives the data at the link layer and sends it to the upper layer in order, all the way to the application layer of the server.
  • When transmitting data between layers, the sender will print the header information of the layer when passing through each layer; On the contrary, when the receiver transmits data with the layer, the corresponding header will be removed every time it passes through the layer.
  • Encapsulation: the way to package data and information is encapsulation

1.4 protocols closely related to http: IP, TCP, DNS

1.4.1 IP protocol responsible for transmission
  • IP protocol innetwork layer
  • IP in TCP / IP refers to the international protocol, which should be distinguished from IP address
  • The role of IP protocol: to send all kinds of data packets to each other, to ensure data transmission, the most importantThe two conditions are IP address and MAC addressThe IP address indicates the address to which the node is assigned, and the MAC address refers to the fixed address to which the network card belongs. IP address and MAC address can be paired. IP address can be changed, MAC address cannot be changed
  • ARP protocol is used to search the next transfer target by using the MAC address of the next transfer device. ARP protocol is a kind of address resolution protocol, which can find out the corresponding MAC address according to the IP address of the communication party
  • In the transit process before reaching the communication target, routing needs to be selected. Routing is like a cargo distribution center for express delivery, distributing network requests
1.4.2 TCP protocol to ensure reliability
  • TCP is located in the transport layer and provides reliable byte stream service
  • Byte stream service: divide the big data and manage the packets in the unit of message segment
  • In order to ensure the data transmission to the target, TCP protocol adopts three handshake strategies.
  • Simple three handshake process:
    1. The sender first sends a packet with syn flag to the other party
    1. After receiving it, the receiver sends back a packet with syn / ack flag to convey the confirmation information
    1. The sender returns a packet with ack flag to indicate the end of handshake
1.4.3 DNS service responsible for domain name resolution
  • DNS protocol is located in the application layer
  • Function: provide resolution service between IP address and domain name.

1.5 relationship between various protocols and HTTP protocol

Illustrated HTTP - Book Sharing (1)

1.6 URI and URL

  • Uri uniform resource identifier
  • URL uniform resource locator, URL is a common web address
1.6.1 uniform resource identifier
  • A URI identifies an Internet resource with a string, and a URL indicates the location of the resource
  • A URL is a subset of URIs
  • Uri example:

ftp://ftp.is.co.za/rfc/rfc.txt
http://www.baidu.com/

1.6.2 URI format

Illustrated HTTP - Book Sharing (1)

  • Protocol name: http, HTTPS, FTP, etc
  • Login information (authentication)

Specify the user name and password as the necessary login information for server-side resources, optional

  • server address

The server address can be www.baidu.com The domain name of can also be the IPv4 address of 192.168.1.1 or the IPv6 address

  • Server port number
  • File path with hierarchy
  • Query string
  • fragment identifier

Recommended Today

Supervisor

Supervisor [note] Supervisor – H view supervisor command help Supervisorctl – H view supervisorctl command help Supervisorctl help view the action command of supervisorctl Supervisorctl help any action to view the use of this action 1. Introduction Supervisor is a process control system. Generally speaking, it can monitor your process. If the process exits abnormally, […]