RU beehive logo ITEC dept promo banner
ITEC 325
2018spring
ibarland

intro: web requests and responses

Recall: In essence, a web-server and web-browser are each functions with the type-signatures:
server : string → string (or, if you have very specific classes, Url → HtmlStr)
browser : string → void (or HtmlDoc → void).
The above is a lie. Let's look more closely.

video: inside http headers (19m54s)

As the video is playing, follow along and be looking at the developer-tools yourself.

Errata: Places where I misspoke, in the video:
06:48 The “Host:” field is just the sever's name (separate from the rest of the URL)
09:38 A better example where knowing user-agent is helpful to server: software-download pages can know what version to suggest.
09:48 “maybe the browserserver could give back a different response, based on which browser I'm using”
15:52 “on future responsesrequests

Looking more closely

For this class, you'll need a browser with good debug-tools built in. For Firefox, there is an extension “Firebug”; I'll demo a couple of Chrome's built-in tools. We will not worry about supporting old browers (e.g. old versions of IE).

» More Tools » Developer Tools
We’ll look briefly at the Elements tab, but today we're mostly concerned with the Network tab, and clicking on particular files. (You might need to click on View » Hide Overview.) In particular, viewing the Request Headers and Response Headers.

Together in class: Spend 15min looking at examples.

Btw, here are the official HTTP response codes, or the cat-picture version.

the real upshot: So, the essence of the situation is actually that the server and browser are functions with the type-signatures:
server: http-request-packet → http-response-packet (where the first packet contains the URL, and the second packet contains the html response);
browser: http-response-packet → void (changing pixels on a screen, as side-effect).1

Further things to consider (if not today, then perhaps later:)


1 Better software engineering might have the browser include functions for the view and the controller: view : http-reponse-packet → Pixel[][] (which in turn calls a helper parse: Stringhtml → DOM), and
control : MouseEvent → http-request-packet, to complete the cycle of (modern-day) life.      

logo for creative commons by-attribution license
This page licensed CC-BY 4.0 Ian Barland
Page last generated 2018.Jan.20 (Sat)
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.