I haven’t written a blog for a long time, either because I’m lazy or because I’m settling myself. During this time, I need to open a new pit for myself (although I still have a pit to fill). I had been trying to find something to write about before, but the knowledge of JavaScript and CSS has been covered badly on the Internet, so that no matter I visit Zhihu, nuggets, segmentfault, there are a lot of related articles on it, as well as various fancy problems of the new laptop… This is the sort of thing that few people seem to talk about (at least as FAR as I can see). Although the book has been very detailed, but a lot of people like me, mediocre aptitude. Here is a note for those of you who want to know more about HTTP but can’t read it.
HTTP and Web resources
So, with all this nonsense, what is HTTP anyway? In layman’s terms, HTTP is a reliable data transfer protocol that ensures that data will not be corrupted or confused during transmission. Usually in the process of surfing the Internet, every visit to the page will produce data transmission, such as pictures, videos, text and so on. JPG,.avi,.txt and other format files, we can provide these Web content files are all called Web resources, HTTP in the process of transmission of these Web resources as a bodyguard ———— to ensure the correctness of data
So how does HTTP differentiate between these different types of resources in transit? The answer is to label every object you want to transfer with a data format called MIME type (Multipurpose Internet Mail Extension). How did HTTP become the key to differentiating between different types of resources? MIME was originally designed to solve the problem of moving messages between different E-mail systems. Because MIME worked so well in E-mail systems, HTTP later adopted it to describe and tag Web resources
The following are common MIME types
text/html
Tag a text document in HTML formattext/plain
Mark a plain ASCII text documentimage/jpeg
Mark the JPEG version of the imageimage/gif
(GIF format imagevideo/quicktime
(Apple’s QuickTime movie genreapplication/vnd.ms-powerpoint
Mark PPT file format usually inHTTP
Communication between Web resources during the processMIME
Types existHTTP
The header of the packet, which will be covered in the next blog post, can be found in the Definitive HTTP Guide
URI
A URI is a Uniform Resource Identifier. On the Internet, resources on the Internet are accessed through URIs. How is a URI represented? There are actually two subtypes of URIs, one is the URL we often hear about, and the other is the URN.
URL
A URL, which is a bit like the name of a URI, stands for Unform Resource Location. As the name suggests, we can pinpoint the location of a resource through the URL. Why is that? Because the format of the URL is usually as follows: the name http://www.baidu.com/sb.jpg in which the front part of agreement, generally for HTTP. In the middle part, www.baidu.com is the domain name of the host, and sb.jpg is the resource name. This tells you exactly where a resource is and how to access it.
URN
URN, like its cousin, is a Uniform Resource Name that stands for Uniform Resource Name. What’s the use? I find UrNs more convenient than urls because all you need to know about urNs is a domain name, independent of where the resource is currently located. In other words, if my site changes address, if I use a URL, THEN I need to inform the user of the new URL, and the user needs to switch to the new URL. But if you use a URN, the resource can always be accessed through a URN, no matter how the address is changed.
conclusion
HTTP is the carrier of web resources in the network, and how to access web resources on the network? Although urNs are more convenient, they are already so widely used on the Internet that it is impossible to replace them anytime soon, and they have few drawbacks other than being longer and slightly harder to remember.