URL and HTTP request message creation

Browser to decrypt URLs

Enter the URL in your browser

A URL (Uniform Resource Locator) is an address that begins with “http:~”.” You can use “https:~”, “mailto~”, or anything else that starts with “ftp:” or “file:”.

Although there are a variety of URLs available, the function of the browser is not just for the client to access the web server. There is also an FTP client for downloading and uploading files, and an email client. Browsers access the data to determine which of these combined functions to use, so there are many different types of URLs for different purposes.

When accessing a web server or FTP server, the domain name of the server and the pathname of the file to be accessed should be embedded in the URL. In the case of an email, embed the email address of the sender in the URL. and so on. You may also draw a username, password, server-side port number, etc., if necessary.

The first thing the browser does is decrypt the URL.

The browser deciphers this URL in order to create a message for the request to be sent to the web server, and since the format of the URL depends on the protocol, let’s take a look at the web server as an example.

According to the HTTP specification, a URL is a sequence of several elements. From the above figure, we first break down the components into pieces as shown in (a). Decomposing the elements of the URL in (b) becomes (c). You can understand the meaning of a URL by examining the order in which each element is decomposed.

For example, if you look at (c) in the decomposition result, the place that represents the name of the web server is named “www.rahakatu.com”, and the part that represents the pathname of the file is followed by the string “/document/index.html”. That is, the URL in (b) accesses the file named “index.html” under the directory (location) /document/~ in the string representing the path “/document/index.html” on the web server named “www.rahakatu.com”. It means “I’m going to do it.

If you omit the file name
  • http://www.yuri.com/index/

For example, if the URL ends with a “/”. If it ends with “/”, it means that there is a file after /index/, not that there is nothing after it, but that the file exists and that the name of the file has been omitted without writing it. This is a URL rule that allows you to omit the file name. This is adapted to the case where a file name is set on the server side in advance in case the file name is omitted. If the omitted file name is set to “index.html”, for example, the above URL means that the file named “index.html” under the “index” directory (folder name) will be accessed after “~/index/index.html”.

  • http://www.yuri.com/index

Also, if there is no “/” after the index, as in the above URL. The meaning of “index” depends on whether it is a file name or a directory (folder name). if it is a file name, it should refer to a file called “index”, but a file usually has an extension. Therefore, it is difficult to judge this “index” as a file name. In this case, it judges that index is a directory (folder name) and accesses the file (index.html, etc.) set on the server within the directory (folder name).

Thus, even if the “/” at the end of a URL is omitted in the server configuration, it is possible to determine the location of the file or directory (folder name) at the end of the URL, or the location of the file that the URL points to from the server configuration.

Leave a Reply

Your email address will not be published. Required fields are marked *