The interviewer dug me a pit: what is the use of "//" in the URI?

When we browse the web, we need to enter the URL address beginning with http: // or https: // in the browser, similar to http://honeypps.com, then ": //" or "//" What use?

When it comes to URLs, you have to mention URIs. What is used to mark resources on the server? The URI (Uniform Resource Identifier) ​​is used, which is the uniform resource identifier. The URI often appears in the address bar of the browser, and sometimes it is also called "network address", or "web address" for short. However, strictly speaking, the URI is not completely equivalent to the URL, it contains URL (Uniform Resource Locator, Uniform Resource Locator) and URN (Uniform Resource Name, Uniform Resource Name).

Due to the high popularity of URLs, in a narrow sense, we can simply treat URIs and URLs as equivalent.

Let's take a look at the format of the URI:

URI = scheme:[//authority]path[?query][#fragment]
authority = [userinfo@]host[:port]

The structure diagram is as follows:

The interviewer dug me a pit: what is the use of "//" in the URI?

 

The first part, the scheme, can be translated into a protocol name, indicating which protocol the resource should use to access. The most common ones are http and https, and others such as ftp, file, etc.

After the scheme, there must be three specific characters ": //", which separate the scheme from the following parts. This is the protagonist of today. If it is used as a distinction, it is entirely possible to use only one letter of ":" instead of the three letters of ": //".

After ": //", there is a part called "authority", which represents the host name where the resource is located. The usual form is "host: port", which is the host name plus the port number. In the past, authority also included identity information userinfo, in the form of "user: passwd @", but it is no longer popular and can be ignored. What is meant by the following content, I believe everyone has been very clear.

When someone asks you // what's the use, it's actually digging a hole. When we are interviewing, often when answering a question, the interviewer will grab a point in your answer for "deep digging", which can also be called "successful serial question", and over time we will form a This kind of habit always feels that there is something deep behind the problem that requires us to think hard. Here, // is a typical counterexample.

In October 2009, a piece of news in the BBC described the use of "//". Original address: http://news.bbc.co.uk/2/hi/technology/8306631.stm. Here I am talking about this report with a screenshot, as shown below:

The interviewer dug me a pit: what is the use of "//" in the URI?

 

In a Times article in October 2009, Berners-Lee admitted that the initial pair of slashes ("//") in a web address were "unnecessary". He told the newspaper that he easily could have designed web addresses without the slashes. "There you go, it seemed like a good idea at the time", he said in his lighthearted apology.

In October 2009, Tim Berners-Lee, the father of the World Wide Web, admitted that it was a mistake to add double slashes in front of the website. He said at a seminar held in Washington, DC, that the plan he originally designed to add "//" in front of the website was neither meaningful nor necessary. If there is a chance to come again, he will remove the double slash.

Yes, you read that right, the "//" in the URI is useless.

Why does Tim Berners Lee say "//" is useless or useless? Here is an introduction by Tim Berners Lee.

On July 27, at the opening ceremony of the 2012 London Olympic Games held at the London Olympic Stadium, a British scientist made a grand debut and accepted the applause. This scene of "Thanks Tim" shocked the world and became a highlight of the opening ceremony. He is the inventor of the Internet, Tim Berners-Lee, an Englishman recognized by the industry as the "father of the Internet". Under the attention of the whole world, he symbolized a sentence in front of a computer: "This is for Everyone", which means: the Internet is dedicated to everyone. Tim Berners Lee was not only regarded as the pride of the British, he also won the respect of the whole world indisputably.

Not only did his invention change the way of life of human beings, and changed the traditional model of global information exchange, it brought a new era of information; more importantly, for the global popularization of the Internet, let everyone use the Internet without restrictions, He announced that he would abandon the patent application for "WWW". It could have been comparable to Bill Gates in money, but he decided to open his Internet achievements to the world free of charge. Individuals lost their sky-high wealth, but benefited all human beings, including us. Today we click almost "WWW" is indispensable in any website, which means that we are constantly sharing Tim's selfless dedication. In 1980, the procedure written by Tim Berners-Lee laid the foundation for the Internet. By October 2007, the number of global websites had exceeded 250 million. It is conceivable that his dedication enabled the rapid development of the global Internet. It also allows all network operators to make countless amounts of money.

On June 8, 1955, Tim Berners-Lee was born in southwest London, England. His parents were both computer scientists and were involved in the design and construction of the world ’s first commercial computer, Manchester Mark I. In 1976 Tim obtained a first-class honorary degree from the Department of Physics at Oxford University. From June to September 1980, Tim proposed a unique concept at the European Organization for Nuclear Research (CERN): to create a project based on a hypertext system that would allow computers distributed around the world to share and update information. At the same time, he created the ENQUIRE prototype system. In 990, Tim developed the world's first web server and the first client browser editing program on the NEXTSTEP network system at that time, and established the world's first WWW website. He deservedly became the founder of the global Internet. Today, WWW and http have become people's daily vocabulary, and the Internet has affected almost all areas of our work, entertainment, socializing and so on. However, Tim never takes pride in himself. When it comes to achievements, he always said calmly: "I didn't invent the Internet, I just found a better way."

Today's knowledge point, have you got it?

Published 238 original articles · Like 68 · Visits 30,000+

Guess you like

Origin blog.csdn.net/qq_45401061/article/details/105409291