current position:Home>HTTP - understand HTTP protocol (I)

HTTP - understand HTTP protocol (I)

2022-05-15 05:15:27Java white in white

HTTP- understand HTTP agreement ( One )

One 、 The story behind the browser

​ When we use a browser to browse a web page , Will enter... In the browser ”www.baidu.com“ Website open Baidu web page , And after outputting the web address , What happened to the browser ?

​ To put it simply , There are the following steps :

  1. After entering the website ( Domain name ), The browser will edit the URL DNS Domain name resolution , It can be interpreted as IP Address
  2. And then through IP Address to access Baidu's server , The browser will send HTTP request
  3. The server receives the request and processes , Then it will respond to the browser , After the browser gets the response data, it parses and renders it
1.HTTP
  • Hypertext transfer protocol (HTTP) It's a kind of Communication protocol , It allows hypertext markup language (HTML) Document from Web Browser delivered by server to client
  • HTTP It belongs to Object oriented protocol of application layer , Because of its simplicity 、 Fast way , Suitable for distributed hypermedia information system .
2.Web And HTTP
  • WEB It's based on hypertext and HTTP Of 、 Global 、 Dynamic and interactive 、 Cross platform distribution Graphic information system
  • Based on the Internet A kind of Network services , It provides an intuitive interface for visitors to find and browse information on the network .

Two 、 through TCP/IP see HTTP

1.TCP/IP Protocol family
  • TCP/IP Protocol is actually a collection of protocols associated with the Internet
  • Hierarchical management is TCP/IP Important features of the agreement
2.TCP/IP Protocol family hierarchy
  • TCP/IP Protocol group is a system composed of a four layer protocol , These four layers are : application layer 、 Transport layer 、 Network layer and data link layer
  • application layer : It's usually the application we write , Determine the application services provided to users . Application layer can communicate with transmission layer through system call , Such as :FTP、DNS、HTTP etc.
  • Transport layer : The transmission layer provides data transmission function between two computers in the network connection to the application layer through system call , There are two different protocols in the transport layer :TCP and UDP
  • The network layer : The network layer is used to process packets that flow over the network , A packet is the smallest unit of data transmitted over a network . This layer specifies the path through ( Transmission route ) Get to each other's computer , And transmit the packet to the other party
  • The link layer ( Network interface layer ): The link layer is used to handle the hardware part of the connected network , Including control operating system 、 Hardware device drivers 、NIC( network adapter ) And optical fiber and other physical visible parts . The scope of hardware is within the scope of the link layer .
3. Packet encapsulation process

 Insert picture description here

4.HTTP Data transfer process
  • When the sender sends data , Data will be transferred from the upper layer to the lower layer , And Each layer will be marked with the header information of that layer . And when the receiver receives the data , Data will be transferred from the lower layer to the upper layer , The header information of the lower layer will be deleted before transmission .
     Insert picture description here

3、 ... and 、DNS Domain name resolution

​ When we enter the URL in the browser ( domain name ) when , The browser will first pass DNS The server resolves the domain name , It can be interpreted as IP Address , And then through IP Address to WEB Server send HTTP request .

DNS Analytic process

  1. DNS First, I will check the hosts Whether there is a mapping of this domain name in the file , If you can find the corresponding domain name IP, Then you will directly visit
  2. If local hosts There is no... In the file , On this machine DNS Look in the parser cache , If you find , Then you will directly visit
  3. If it's on this machine DNS The parser cache cannot query , Then I will go to Local DNS The server (TCP/IP Preferences set in parameters DNS The server ) Make a request to get IP Address
  4. If local DNS The server could not get IP Address , Then it will be forwarded , Up one level DNS The server sends for parsing

copyright notice
author[Java white in white],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/131/202205111248303363.html

Random recommended