1. What is HTTP

HyperText Transfer Protocol (HTTP) is a Protocol specification that implements a series of operations from the client to the server. An agreement is a stipulation of rules. It can be said that the Web is built on the HTTP protocol for communication.

2. Basic TCP/IP network

Commonly used networks operate on the basis of the TCP/IP protocol family, of which HTTP is a subset.

2.1 protocol (protocol)

Protocol: When a computer communicates with a network device, the two sides need to follow the same rules (for example, how to detect the target, which side initiates the communication, which language to use, how to end the communication, etc.). One of these rules is called protocol.



TCP/IP
TCP/IP
TCP
IP

2.2 the TCP/IP model

Application layer: The communication activities that determine the provision of application services to users. The TCP/IP protocol family stores various common application services. For example, FTP[File Transfer Protocol] and DNS[Domain Name System] are changed, and HTTP is also at this layer. Transport layer: Provides data transfer between two computers in a network connection. Transmission Control Protocol (TCP) and User Data Protocol (UDP) are at this layer. Network layer: Handles packets flowing over the network. A packet is the smallest unit of data transmitted over a network. The layer pair determines which transmission route to take (one data route among many paths) to reach the other computer and send the data to the other computer. The Internet Protocol (IP) belongs to the data link layer of this layer: it is used to process the hardware part of the unicom network. Physical visible parts include the control operating system, device driver, Network Interface Card (NIC), and optical fiber.



The sender
In the play
The first information
The receiving end
The corresponding heads cancel out



Encapsulate



#3. Protocols closely related to HTTP: IP, TCP, and DNS

3.1 IP protocol responsible for transmission

Internet Protocol (IP): All network systems use the IP Protocol (IP in the TCP/IP Protocol family). Don’t confuse IP with IP addresses. IP protocol: the function is to transmit various data packets to each other. Transmit the correct condition:

  • IP address: the IP address assigned to a node
  • MAC address: specifies the fixed IP address of the NIC. (THE IP address can be matched with the MAC address, and the MAC address can be changed.)

Address Resolution Protocol (ARP) : Address Resolution Protocol. Check the CORRESPONDING MAC address based on the IP address of the communication party. The communication between IP addresses depends on MAC addresses. On the network, the normal two-way communication needs to go through a number of computers and network devices to connect. During the transfer, the MAC address of the next transfer device is used to search for the next transfer destination. In this case, the ARP protocol is used.


3.2 TCP to ensure reliability

TCP belongs to the transport layer and provides reliable byte stream service to transmit data accurately and reliably to each other

Byte Stream Service: Divides a chunk of data into packets based on segment for easy transmission.

TCP uses a three-way handshaking strategy to send data to its destination without error. After the packet is sent, the system confirms whether the packet is successfully delivered. Handshake flag:

  • SYN(synchronize): The sendersendSYNFlag to the server
  • ACK(acknowledgement): The service sidereturnSYN/ACK“Is for confirmation
  • The lastThe senderBack againACKRepresents the datagram ofShake hands over. If the handshake process is at some stageinterruptTCP protocolOnce again,In order toThe same ordersendSame packet.


3.3 DNS Service for Domain name Resolution

Domain Name System (DNS): an application-layer protocol that resolves Domain names to IP addresses or reversely queries Domain names from IP addresses.


4. The URI and URL

Uniform Resource Identifier (URI) : Uniform Resource Identifier. The location identifier of a resource represented by a protocol scheme. The protocol scheme indicates the name of the protocol type used to access resources. For example, the HTTP protocol scheme is HTTP.

  • Uniform: rulesUniform formatconvenientTo deal withA variety ofDifferent types ofThe resources.
  • Resource: Anything identifiable.
  • Identifier: An identifiable object, also called an Identifier.

URL(Uniform Resource Locator) represents the location of a resource (Internet location), which is a subset of the URI.

URI format


The diagram above shows the format of an absolute URI, where each specific attribute is described as follows:

  • Pass the protocol scheme namehttp:https:When obtaining access resourcesSpecifies the protocol type, can also be useddata:orjavascript:Specifies the schema name of the data or script
  • Login authentication: Optional login information required to obtain resources from a service
  • The server address can be a domain name (resolved using DNS) or an IP address
  • Server port number: Network port number of the connected server. This parameter is optional.
  • Hierarchical file path: Specifies the file path on the server to locate the specified resource
  • Query string: You can use the query string to pass in arbitrary parameters
  • Fragment identifier: Tag to get a child resource within a resource (somewhere within a document)