eekim.com > Talks > CGI Programming slides (1996)

Request/Response    (01)

The Web obeys what's called a "request/response paradigm." This means that when the browser wants a file, it sends a request which garners an immediate response from the server. The response could be anything from "ok, here's the file" to "can't find the file."    (02)

Example: Suppose you want to get a home page. Your browser will send a request to the server asking for index.html, and the server might return something like:    (03)


<html> <head>
<title>Home Page</title>
</head>

<body>
<h1>Home Page</h1>

<img src="picture.gif">

</body>
</html>    (04)

Note that there is an inline image on this page. The server, however, does not know this. All it knows is that the browser wants the file index.html, so it sends only that file. When the browser receives it, it parses the file and checks for inline data. When it finds the reference to picture.gif, it makes a second request to the server. Upon receiving this request, the server responds with picture.gif. Now, the browser can properly render the home page.    (05)

MIME Types    (06)

How does the browser know what kind of data it is receiving? Before sending the data, the server sends a header that identifies the type of data it is sending. It uses the Multimedia Internet Mail Extension format to do so. For example:    (07)

Content-Type: text/html    (08)

identifies the data being sent as HTML.    (09)

In order to differentiate the actual data from indentifying headers, the server sends the headers first, a blank line, then the data.    (010)

Next | Table of Contents | Previous    (011)