Three parts to each HTTP client request and each
HTTP server response:
Request or response line: specifies the contents
of the request or the status of the response, respectively.
Request or response headers (optional): specify configurations, acceptable
formats, and lots of other things the browser and the server want to
tell each other; e.g., the
date and time the file was last modified; whether the file may be
cached or not, etc.
Request or response body (optional): additional data; e.g., the actual data passed back
from the HTTP server or any additional data the server must know in order to
execute a request.
HTTP is a so-called stateless protocol: each transaction is independent of the previous ones; i.e., the process has no memory!!
Simplicity: browsers and servers do not need to keep information around between interactions.
Would get complex with multiple users.
Do not know how long info must be kept around (does the client ever come back?).
The vast majority of HTTP transactions do not require state maintenance; i.e., retrieving and viewing a Wikipedia page.
However, multistep conversations are not stateless; e.g., booking a flight, buying a book on the web:
Example: buy a book on the web:
Client issues request for information about book X.
Server replies with price and availability.
Client issues request to put the book in the shopping cart.
But!!! HTTP is stateless —> step 3 is independent of steps 1 and 2 —> In step 3, the server has no memory about steps 1 and 2, including which
book is involved, who you are, etc.!
Problem: Can you
devise one or more (conceptual!) workarounds? Keep in mind that you cannot(!!) change HTTP to maintain state.
For each workaround, think of advantages and disadvantages:
'Memory-on-the-go' or 'Memory-in-transit': The
server passes all the information back to the client and forgets about the client. But at the next request, the
client passes everything it received from the server (back) to the server, and adds any information it wants to submit.
Rather than endowing either the client or the server with memory, we accumulate memory as we carry it back and forth between
client and server.
The memory is always in transit between server and client.
How to pass this information back and forth?
From client to server: depends on which HTTP method we use:
combinations in the URL;
Between which actors and in which direction is SQL passed?
What happens when an HTTP client requests a page which exists but to which the server will not provide access?
Where are cookies stored?
How does the 'memory-on-the-go model work (in concept)?
In your mind, reconstruct one complete full Web stack round-trip, starting with the HTTP client, which represents what happens when
a browser requests information on flights between two cities on a particular date.
In the 4-tier web stack, where is the HTML generated?
In the 4-tier web stack, where is the XML generated?
What is an <input type="hidden"> HTML tag used for and how is it used?