16.1. Introduction to HTTP¶
16.1.1. What is HTTP?¶
In computing situations that involve the exchange of data, the term protocol is used to describe a standard set of rules that are expected to be followed to facilitate that data exchange [PROTOCOL]. One of the most used protocols is the HyperText Transfer Protocol (HTTP), which defines the standard data exchange procedure used by the World Wide Web (Web or simply the web).
16.1.2. The Protocol¶
Whenever a program (e.g., a web browser) tries to access web content
(i.e., content located at a http://
-prefixed or
https://
-prefixed URL or URI), it uses an HTTP client
(web client) to communicate with the HTTP server (web server)
that hosts the content. Sometimes the program itself is an HTTP client
(i.e., it knows all the protocol details); however, it is more common
these days to use an HTTP client provided by a library.
From a program’s perspective, the following steps are taken to access web content:
construct an HTTP request message,
use an HTTP client to send the HTTP request message to the HTTP serverm
(hopefully) receive an HTTP response message, then
decide how to update its program state.
Here is diagram that illustrates the entire high-level data exchange that might occur when a program attempts to access content hosted by an HTTP server:
If you’re interested in the low-level details of HTTP, then we encourage you to take a “Computer Networks” class, read the HTTP/1.1 specification, or both!