URL
URL (Full name: Uniform Resource Locator), Chinese name is Uniform Resource Locator, commonly known as web address or website. Used to specify the address of a resource on the Web. Each valid URL points to a unique resource.
The composition of the URL
Protocol + Domain name /IP + port number + path + Query parameters + anchor point
The default port is 443
1. The agreement
It is used to transfer information between the Web browser and the Web server. Generally, the protocol can be HTTP or HTTPS
1.1 HTTP (Hyper Text Transfer Protocol)
Hypertext transfer protocol: The server uses port 80 to provide services by default. Data transmitted through HTTP is unencrypted, that is, plain text. Therefore, it is very insecure to transmit privacy information through HTTP.
1.2 Hyper Text Transfer Protocol over SecureSocket Layer
Hypertext Transfer Security protocol. The server uses port 443 to provide services by default. HTTPS is a network protocol constructed by SSL and HTTP for encrypted transmission and identity authentication, which is more secure than HTTP.
2. IP
IP is used to locate a device and encapsulate data packets to communicate with other devices (such as the computer at home, router, network, etc.). They all have their own independent IP addresses. IP is also divided into internal IP and external IP.
So how do we query our Intranet IP?
First, open our command line and type ipconfig on the command line. Something like the picture below will appear
IPv4 in the picture is the Intranet IP we have queried. After we have broadband access, telecom will assign us an IP address.
Note:
Several special IP addresses
127.0.0.1 and localhost indicate that the local localhost can be modified using the host file. Hosts in C:\Windows\System32\drivers\etc\hosts 0.0.0.0 does not indicate any device
3. The domain name
What is a domain name?
A domain name is just another name for IP. (for example: QQ.com baidu.com) It is divided into top-level domain name, level-1 domain name, level-2 domain name and level-3 domain name. Usually we call the end of “.com” a top-level domain; Xxx.com is a second-level domain name (commonly known as a first-level domain name; www.xxx.com is a level 3 domain name (commonly known as level 2 domain name).
Domain name can be simply understood as the way to your website, usually consisting of a string of characters and suffixes, common suffixes are com, net, CN and so on
Compared to IP, domain names are easier to remember
- Com A commercial organization or company
- Cn Chinese domain name
- Org A non-profit organization or group
- Gov Government Department
- Mil Military division
- Net An organization or company that works on the Internet
- Cc unlimited
- TV unlimited
- Ac Research Institute
So how do we get the IP for these domain names?
To obtain the corresponding IP address, run ping http://qq.com or ping http://baidu.com. Ping means request. Every time we ping, we return an IP.
Load balancing and shared host load balancing means that A domain name is bound to the ABCD IP addresses at the same time. When A user in area A accesses the IP address of AREA A, the user in area B accesses the IP address of area B. A shared host binds n domain names to an IP address. Multiple sites share one server; If a user accesses two domain names bound to the same IP address, the same IP address is returned.
4. Port
Port: port. Ports in an IP address refer to logical ports, which are logically used to distinguish services. Ports of an IP address are numbered with 16 bits. A device has a total of 65535 ports. Ports 0 to 1023 are system ports. When we use ports, we start at 1024. When a port is occupied by another domain name, you have to switch to another port (because this port is already in use). Note that port 80 is recommended for HTTP, port 443 for HTTPS, and port 21 for FTP. In the browser, we usually see no port after the domain name in the URL. This port is usually 80 by default.
Path of 5.
Used to visit the same website of different pages, can request static resources, query background data path generally refers to when we initiate a request, he will go to request this domain name corresponding root directory “/”. Start with the last slash (/) and end with? So, is the path part, if there is no? , is from the last “/” after the domain name to “#”, is the path part, if there is no “? And “#”, then from the last “/” after the domain name to the end, is the path part.
6. Query string
The query string is used to access different data on the same page. The query string is usually used when we want to know the results quickly, for example: baidu.com/s?wd=hello Search “the content of hello” in Baidu directly through the query string.
Such as: baidu.com/s?wd=hello&… Search for “the contents of Hello” directly from the query string and look at the 31st result.
7. The anchor
Used to locate the positions of the page, and does not support Chinese, the browser will be transformed into digital, aiming point only related to the browser, has nothing to do with the server, so the anchor will not spread to the server an article introduces multiple content at the same time, but now I just want to see the one part, then we can be done by adding the anchor point. Such as: developer.mozilla.org/zh-TW/docs/…
DNS
Domain Name System (DNS) The Domain Name System (DNS) provides network services that match Domain names with IP addresses. Users can access websites by simply entering Domain names instead of long and difficult IP addresses, because the DNS service automatically converts Domain names to correct IP addresses.
Nslookup QQ.com can be used to resolve Tencent’s DNS server in the command line
Enter the URL in the browser address bar
- The browser requests the DNS server (domain name system/service) to resolve the IP address corresponding to the domain name in the URL
- The TCP connection is established with the server based on the obtained IP address and port number
- The browser sends an HTTP request to read the file. The request packet is sent to the server as the third packet of the TCP three-way handshake
- The server responds to the browser request and sends the corresponding HTML text to the browser, releasing TCP
- Display the captured page to the user
The curl command
You can send an HTTP request to curl-v http://baidu.com curl -s-v — https://www.baidu.com
- The url will be rewritten by the curl tool, which will request DNS to obtain the IP address
- The TCP connection is established first. After the TCP connection is successful, HTTP requests are sent
- Request a look at the content
- Take a look at the response content
- When the response ends, close the TCP connection.
- Really over