0% found this document useful (0 votes)
8 views10 pages

Exercise HTTP

The document contains exercises related to HTTP requests and responses, including analyzing HTTP headers, calculating transfer times for web pages, and understanding the impact of caching on response times. It provides detailed solutions to each exercise, explaining the requested URLs, HTTP versions, connection types, and the effects of proxy caching. Additionally, it includes calculations for total time required for downloading web pages under various conditions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

Exercise HTTP

The document contains exercises related to HTTP requests and responses, including analyzing HTTP headers, calculating transfer times for web pages, and understanding the impact of caching on response times. It provides detailed solutions to each exercise, explaining the requested URLs, HTTP versions, connection types, and the effects of proxy caching. Additionally, it includes calculations for total time required for downloading web pages under various conditions.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Exercise 1 : HTTP

In the following you can find the content of an HTTP Request.


Answer to the following questions, indicating where (e.g., in which field) in the HTTP
Request you can find the answer:

GET /martignon/[Link] HTTP/1.1


Host: [Link]
User Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/124
(KHTML, like Gecko) Safari/125
Accept: ext/xml, application/xml, application/xhtml+xml, text/html;q=0.9,
text/plain;q=0.8, image/png,*,*;q=0.5
Accept-Language: it
Keep-Alive: 300
Connection: keep-alive

1) What is the requested URL?


2) Which version of HTTP is used?
3) Does the browser ask for a persistent or a non-persistent connection?
4) What is, in your opinion, the utility in indicating the type (and version) of browser used by
the client in the HTTP Request?

Solution Exercise 1 : HTTP

1) The requested URL is (see the first two lines of the HTTP message): [Link]
/martignon/[Link]
2) The HTTP version used is 1.1(first line of the HTTP message)
3) It’s a persistent connection (the header part concerned is connection:keep-alive ).
4) The information on the browser type is needed to “customize” the answer on the browser
(e.g., if the HTTP server needs to send a “mobile” version of a website to the client, on a
smartphone).
Exercise 2 : HTTP

An HTTP client sends the following message:

GET [Link] /[Link] HTTP/1.1


User-agent: Mozilla/4.0
Accept: text/html, image/gif, image/jpeg
If-modified-since: 27 Feb 2017 08:10:00

a) Write down two feasible responses of the HTTP server (only the status line)
b) Assuming that the message is sent through a Proxy, specify the behavior of the Proxy itself

Solution Exercise 2 : HTTP

a) Server Responses:

HTTP/1.1 200 OK
HTTP/1.1 304 Not Modified

b) The Proxy crosschecks if the resource is available in the local cache.


• If not:
o Forwards the message to the server
• If so, crosschecks the date associated to the resource:
o If it’s older than the one specified in the message If-modified-since, it forwards
the message to the server.
o Otherwise??
Exercise 3 : HTTP

An HTTP client requests to an HTTP server a web page constituted by one main object (an
HTML file) and 10 other objects. Each object has a size equal to L=200 [kbit]. The
bidirectional connection between the client and the serve has a capacity of C=100 [kbit/s].
The control messages used to open the TCP connection between the client and the server, as
well as the HTTP “GET” message, have a size m=100 [bit]. The propagation delay of the link
is tau = 100 [ms].

Compute the total time necessary for the client to receive the web page and the 10 objects in
the two following cases:
a) The HTTP client opens in parallel and in a non-persistent way all TCP connections
necessary to download the web page and the 10 related objects (let us assume that the
transmission rate of all TCP connections is equal to r=C/N, where N is the number of
connections open in parallel)
b) The HTTP client opens serially 11 TCP connections, in a non-persistent way.
Solution Exercise 3 : HTTP
Exercise 4 – HTTP (link sharing)
An HTTP client requests to an HTTP server a web page constituted by one main object (an
HTML file) and 11 other objects. Each object has a size L=50 kByte. The link (bottleneck)
between the HTTP client and server can transfer information bidirectionally at a rate
C=1Mbit/s. The messages used to open a TCP connection between the client and te server as
well as the HTTP GET message have all negligible size. The Round Trip Time (RTT) is equal to
150 ms. The link is shared with 9 other long-lived file transfers with other servers.

Assuming that all transfers share the link capacity in a fair way, thus obtaining an average
transmission rate equal to C/n, where n is the number of parallel transfers, compute the
total time necessary to receive the whole web page (including its objects) in the two
following cases.:
- a) the HTTP client opens a single persistent TCP connection to downloads all objects of the
web page.
- b) the HTTP client opens in parallel and in a non-persistent way all TCP connections
necessary to download the webpage.
Exercise 4 : Solution

a) In the first case we have the following temporal scheme:

The effective transmission rate is given by the sharing of the link capacity among the 9 long-
lived, interfering flows and the one related to the HTTP exchange, hence in total we have
9+1=10 flows.
b) In the second case we have the following temporal scheme:

The time necessary to transfer the HTML page is equal to the previous case since the
situation is the same.

The effective rate with which the objects are exchanged is instead different, since now 11
connections are opened in parallel. The effective rate is hence given by dividing the link
capacity for 9 interfering flows plusthe 11 connections, hence 9+11=20 flows in total.

Hence the total transfer time is:


Exercise 5 – HTTP (caching)
An organization owns a Local Area Network (LAN) with an HTTP proxy having a local cache
(see Figure 1). Clients are connected to the HTTP proxy with a dedicated high-speed
connection having capacity C=1 [Gb/s]. The probability that the content (a web page)
requested by a generic client is found in the cache of the local proxy (cache hit rate) is P=0.4
(of course, the probability that the web page is not found in the cache is equal to Q=0.6).
Calculate the average delay experienced by a generic client, from the instant in which it
sends the HTTP request for a web page to the time in which it obtained the requested page.
Let us assume that:
• the http request messages have size of 100 [byte],
• the requested webpage has size equal to 100 [kbyte],
• the HTTP proxy has a communication channel with equivalent capacity c=100 [Mb/s]
towards the origin server that hosts the requested webpages
• the opening and closing time for TCP connections between the client and the proxy as well
as between the proxy and the server is negligible,
• propagation delays are negligible.

Exercise 5 - Solution

If the requested webpage is available in the local proxy, the time necessary to download it is
equal to the time necessary for the client to send the HTTP request message to the proxy
and to receive the HTTP response from the proxy itself, containing the required webpage. In
formulas:

Substituting the parameters values we obtain: T1= 0.8008 [ms]. Please note that we did not
consider (i.e., we implicitly considered them as negligible) the time necessary for the HTTP
proxy to process the request.
In case the requested webpage is not available at the local proxy, the time necessary to
obtain the page is equal to (i) the time necessary for the client to send a request to local
proxy, plus (ii) the time necessary for the proxy to send the HTTP request to the web server,
plus (iii) the time necessary for the web server to send back the HTTP response containing
the desired page, plus (iv) finally the time for the proxy to send the page to the client. In
formulas:

Where parameters’ values are the same as in the previous case, except for capacity c which
is the capacity of the connection between the proxy and the web server. Substituting the
parameters’ values we obtain: T2=8.808 ms. Please note that we did not consider (i.e., we
implicitly considered them as negligible) the time necessary for the HTTP proxy as well as of
the web server to process the request.

The average total time necessary to obtain the webpage is therefore:

Taverage = P*T1+Q*T2

equal to Taverage = 5.6056 ms

Figure 2 hereafter reports the trend of the Taverage value as a function of the cache hit rate, P.
As we expected, the average time to obtain the webpage diminishes linearly as the
probability that the webpage is available “closer” to the end client (i.e., in the cache of the
proxy server).

You might also like