Moment For Technology

HTTP Introduction Notes 1(Brief Analysis of urls)

Posted on June 24, 2022, 3:30 a.m. by Anna Saunders-Baker
Category: The front end Tag: http

The URL is analysed

"-- Photo from Internet

preface

Sir Lee invented WWW(URL+HTTP+HTML), HTML we have learned, this article mainly from the understanding of IP, port, domain name, DNS operation to understand the URL- source hungry people valley

URL

URL(Uniform Resource Locator)

The URL consists of "protocol + domain name or IP+ port number + path + query string + anchor"

Note: Anchor points are not transmitted to the server

So let's talk about URL structure and let's start with IP


1 What is IP?

1.1 introduction

Check out the IP Wikipedia

An IP is an intent protocal

Is a protocol used in packet-switched data networks. IP transmits data based on the addresses of the source and destination hosts

IP basically promises two things:

  1. How do I locate a device

  2. How to encapsulate data packets for communication with other devices

Anyway, you can't get online without IP.

As long as there is at least one independent IP on the Internet

1.2 IP is classified into external networks and internal networks.

  • Extranet IP is not a router (like telecom DNS server, or other users) can go to IP138.com to view their extranet IP

  • The internal IP address is the IP address inside the router. Without the router, you cannot access the Internet.

1.3 Description of Router Functions

Router now have two IP, an external network IP and devices in a network IP network can visit each other, but can't have direct access to the network, network device you want to access the network must be the router in the transit network equipment can visit each other, but don't have access to your Intranet network equipment to deliver content to a network, You also have to go through the router which means that the Intranet and the extranet are like two separate Spaces, you can't communicate with each other, and the only point of contact is the router so routers are sometimes called gateways.

1.4 There are several special IP addresses

, respectively,

  • 127.0.0.1 indicates itself and loopback the test IP address

  • Localhost Specifies itself as host. You can set the string to the corresponding IP address 127.0.0.1...

The host file is in c-system32-drivers-etc-hosts

  • 0.0.0.0 does not indicate any device

If you know the IP, you also need to know the port


Port 2.

A machine can provide many services, and each service has a number, which is called the port number

One machine provides different services

  • Port 80 is best used to provide HTTP(Hypertext Transfer Protocol) services

  • Port 443 is best used to provide HTTPs(Hypertext Transfer Security Protocol) services

  • To provide FTP(File Transfer Protocol) service, port 21 is preferred

There are a total of 65535 ports, and different port numbers correspond to different services. See Wikipedia for details about what services each port number corresponds to.

2.1 Are there any rules for port usage

The rules

Ports 0 to 1023 (2 ^ 10 minus 1) are reserved for system use, and you can only use these 1024 ports if you have administrator privileges. Other ports can be used by common users. For example, http-server uses port 8080 by default. If a port is occupied, you have to change it to another port

In short, both port and IP are indispensable


3. What is a domain name

Domain name is another name for IP

For example,

  • What IP address does Baidu.com correspond to

Ping baidu.com

Run the nslookup baidu.com command to view the Baidu IP address

  • What IP address does QQ.com correspond to

Command line ping qq.com

Command line input nslookup qq.com you can see qq IP

  • A domain name can correspond to different IP addresses

This is called load balancing and prevents one machine from being overwhelmed by an IP that can be assigned to a different domain name

  • An IP address can correspond to different domain names

This is called shared hosting

Windows+ R Enter CMD to go to the CLI

3.1 'Is www.qq.com' the same domain name as QQ.com?

A: Not the same domain name

Q: What is their relationship?

A. They are father and son

Com is a top-level domain name

Qq.com is a level 2 domain name (commonly known as level 1 domain name)

'www.qq.com' is a level 3 domain name.

It is possible that the second level domain and the third level domain are not the same company

Github. IO, for example, gives you the subdomain xxx.github

So you should know that www.qq.com and QQ.com may not be the same company

Is the WWW redundant? Yes, very redundant.

3.2 Domain names and IP addresses are mapped through DNS

DNS is a domain name resolution service/system


4. How does DNS work?

  • process

- Your Chrome browser will ask the DNS server provided by Telecom/Unicom what IP address qq.com corresponds to.

- TELECOM/Unicom will answer an IP

- Chrome then sends the request to port 80(HTTP)/443(HTTPS) of the corresponding IP

- Request content is to view qq.com home page

  • Why port 80 or 443

The server provides HTTP services with 80 by default

The server uses 443 to provide HTTPS by default

You can see the specific ports in the developer tools


Path of 5.

How do you request different pages - paths can do that

Such as

Developer.mozilla.org/zh-CN/docs/... And developer.mozilla.org/zh-CN/docs/...

By changing the HTML and CSS, changing the path, you can view the corresponding content based on what it has,

You can use the Chrome Developer Tools Network panel to see the difference


6. Query parameters

Same page, different content - query parameters can do this

Such as

www.baidu.com/s?wd=hi and www.baidu.com/s?wd=hello.

PI over s is the path, right? Wd =hello is the query parameter, baidu result is 10, pn=10 is the first 10 results do not see from the second page


7. The anchor

Anchors are not passed to the server; anchors are browser dependent

Developer.mozilla.org/zh-CN/docs/...

The tutorial is an anchor on this page called reference books

The anchor appears to have Chinese, but does not support Chinese

The # reference book becomes #%E5%8F%82%E8%80%83%E4%B9%A

Anchor points are not visible in the Network panel because they are not passed to the server


In summary, urls

The URL consists of "protocol + domain name or IP+ port number + path + query string + anchor"

Ex. :

www.baidu.com/s?wd=hello...

--continue


Learning the front end from the beginning to the ground, I'm on my way. Every time you watch, is the biggest encouragement on my way to study, work hard together!

Welcome to leave your valuable comments.

Search
About
mo4tech.com (Moment For Technology) is a global community with thousands techies from across the global hang out!Passionate technologists, be it gadget freaks, tech enthusiasts, coders, technopreneurs, or CIOs, you would find them all here.