Revisiting HTTP

I’m finally revisiting, reviewing, and taking notes from this Introduction to HTTP, so this post will have some overlap with this previous one, as well as this one.

An Overview

HTTP is known as a request-response protocol, wherein the client (often, but not always, a web browser) sends a request to a server and waits for a response. The server then sends the client a collection of resources (CSS, HTML, Javascript, videos, images, other assets).

Such a transaction might proceed like this:

HTTP is a stateless protocol in that each request-response pair is completely independent of the previous one: the server doesn’t need to hang on to information (i.e., state) between requests. HTTP is stateless, but a stateful experience can be (and often is) simulated by employing various web development frameworks.

The Domain Naming System (DNS) is a distributed database which translates URL names to their respective IP addresses and maps the request to a remote server. DNS databases are stored on a worldwide network of hierarchically organized DNS servers; no single DNS server stores the entire database.

What is a URL?

URL components Description
scheme Tells the client how to access the resource (http, ftp, mailto, git)
host Tells the client where the resource is hosted or located
path Shows what local resource is being requested
port number Is used by the host to listen to HTTP requests

The default port number for HTTP is 80, and although it’s not always specified, it’s assumed to be part of every URL. To use anything other than the default, it has to be specified in the URL.

A query string or parameter within the URL usually contains some form of data to be sent to the server. A simple URL with query strings might look like:

Query string component Description
? A reserved character that marks the start of the query string
search=ruby A parameter name/value pair
& A reserved character that's used to separate multiple parameters