URLs, man

This afternoon, I read about URLs in Introduction to HTTP. Again, many thanks to Launch School for making this book available via their Open Book Shelf. My notes are directly attributable to the content from their book.

cherimoya

Image is from here.

A URL comprises 3 main components:

URLs can also include a port number which the host uses to listen to HTTP requests. The default port number for HTTP is port 80. Even though this port number isn’t always specified, it’s assumed to be part of every URL. Unless a different port number is specified, port 80 is used by default in normal HTTP requests.

hass avocado

Image is from here.

A URL might also include a query string or parameter, which usually contains some form of data to be sent to the server. In the following URL…

http://avocadoshop.com?variety=hass&size=tiny&status=ripe

… name/value pairs in the form of variety=hass, size=tiny, and status=ripe are passed to the server from the URL. This request asks the avocadoshop.com server to locate a record with the given parameter values.

pomegranate tree Image is from here.

By default, URLs accept only certain characters in the ASCII character set. URL encoding replaces non-conforming characters with a % symbol followed by two hexadecimal digits that represent the ASCII code of the character, e.g.:

http://pomegranate-world.org/pomegranate%20trees.html

N.B. & (ampersand) is reserved for use as a query string delimiter. : (colon) is also reserved to delimit host/port components and user/password.