Professional Documents
Culture Documents
Lab07 HTTP
Lab07 HTTP
1. Overview
In this lab, students will explore several aspects of the HTTP protocol: the basic GET/response
interaction, HTTP message formats, retrieving large HTML files.
2. Objectives
This lab aims to provide students with ability:
Important notes:
On some system the web-server container might fail to start because of different ways that
newline character is encoded in script file. When that happen, please follow the steps below to fix:
You must read section 2.2 (page 98) of textbook [3] before doing this task.
Open the developer tools in your browser, then use network tab to examine request/response header.
More information about its interface, please refer to this link.
4.2. The HTTP CONDITIONAL GET/response interaction
Recall from Section 2.2.5 of the text, that most web browsers perform object caching and thus often
perform a conditional GET when retrieving an HTTP object. Before performing the steps below, make
sure your browser’s cache is empty.
a) Inspect the contents of the first HTTP GET request from your browser to the server. Do you
see an “IF-MODIFIED-SINCE” line in the HTTP GET?
b) Inspect the contents of the server response. Did the server explicitly return the contents of the
file? How can you tell?
c) Now inspect the contents of the second HTTP GET request from your browser to the server.
Do you see an “IF-MODIFIED-SINCE:” line in the HTTP GET1? If so, what information follows
the “IF-MODIFIED-SINCE:” header?
d) What is the HTTP status code and phrase returned from the server in response to this second
HTTP GET? Did the server explicitly return the contents of the file? Explain.
In the browser of the host machine, input http://localhost:5050/welcome.php, a page contains 2 forms
will be displayed. These forms will send GET or POST message when involving submit button is clicked.
Try various Input form values, then click submit. Explore request messages both in terminal of sniffing
host and developer tools in browser for GET/POST messages. What can you conclude about the
behavior of these request messages.
For the HEAD request, the web server will reply only the response header, try this by issuing this
command at the client-host’s terminal:
curl -I http://172.16.10.100
You must read section 2.2.4 (page 108) of textbook [3] before doing this task.
1
Hint: ideally, you should see an If-Modified-Since header since you’ve just downloaded this page a few seconds
ago. However, depending on the browser you’re using, and the format of the server’s earlier response to your
initial GET, your browser may not include an If-Modified-Since even if the document has been downloaded and
caches. The Chrome browser is pretty good at regularly using If-Modified-Since. But Safari and Firefox are much
more finicky about when to use If-Modified-Since. Life isn’t always as easy in practice as it is in theory!