Vous êtes sur la page 1sur 5

Lesson 04: The Web and HTTP

4.0 Introduction

The internet was used primarily by researchers, academics, and university students to log into
remote hosts, to tranfer files from local hosts to remote hosts and vice versa. The World Wide
Web was introduced in the 1990s. The web is the intenet application that caught the general
publics general eye. The the internet is yet another electronic communication technology with
a major social impact. Email and the Web, two of its most popular applications have changed
how we live and work. We will cover the Web and its application layer protocol in this section.

Learning outcome:

After completing this lesson, you will be able to:

Differentiate the Nonpersistent and Persistent connections

Describe the HTTP message format

Identify the fields in the HTTP message format

Explain the use of the cookies

4.1 Overview of HTTP

HTTP is a protocol that allows Web browsers to talk to servers and exchange information. HTTP
provides a standard way of communicating between browsers and Web servers so any browser
can talk to any server, provided that they both conform to the HTTP specification. HTTP expects
the client to initiate a request and the server to respond.

Differentiate the Nonpersistent and Persistent connections

The major difference between nonpersistent and persistent protocol is the number of TCP
connection(s) that is (are) required for transmitting the objects. Nonpersistent HTTP
connection requires that each object be delivered by an individually established TCP
connection.

1
Usually there is one RTT delay for the initial TCP connection.

The parallel TCP connections are used by nonpersistent HTPP to improve the performance,
i.e., to speed up the response time. Ideally, the shortest time that it can receive all objects is
two RTT (one for initial TCP, one for request and response) plus the transmission time of the
largest objects assuming that all the TCP connections can be established simultaneously.

Persistent HTTP connection without pipelining is that each client (browser) has to wait for
the previously requested object received before issuing a new request for another object.
Not counting the initial TCP establishment (one RTT time), each object needs at least one
RTT plus the transmission time of the object by the server; Persistent HTTP connection with
pipelining can allow a client to send out multiple (or all) requests, so servers can receive all
requests at once, and then sending responses (objects) one after another, hence the name
of pipelining. The shortest time is one initial RTT, another RTT for request and response, plus
the transmission time of all objects by the web server.

4.2 HTTP message format

There are two types of HTTP messages. Request messages and response messages. Both these
formats are outlined briefly.

HTTP request format

GET, most commonly used request to web server for objects


POST, to fill out a form. In this case, the message format on Slide 229 contains the
content in the field of Entity Body.
HEAD, similar to GET command except HTTP responds with no requested objects.
This is used for debugging. Noticing in both GET and HEAD, the entity body in the
request message is empty

The HTTP generic message format is as follows:

<startline>
<messageheaders>
<emptyline>
[<messagebody>]
[<messagetrailers>]

2
The fields in the HTTP message format

Get /Index.html HTTP/1.1 Request Line


Date: Thu, 05 May 2008 21:12:55 GMT General Header
Connection : close
Host: www.facebook.com
From:raj260@yahoo.com Request Header HTTP
Accept: text/html, text/plain Request
UserAgent: Mozilla/4.0 (compatible: MSIE 6.0: Windows NT 5.1)
Entity Header

Blank Line
Message Body

4.3 UserServer Interaction Cookies

Cookies are short pieces of data used by web servers to help identify web users. It allows
keeping track of the users that log into their servers and would recognize the user at the next
log in. A cookie consists of four parts.

a. Cookies Header line in the HTTP request Message


b. Cookie Header line in the HTTP response Message
c. A cookie file kept on the users end system and managed by the users browser
d. A back end database at the web site.

Here is how user server interaction happens as a cookie is passed.

Server send cookie to client in response message (set cookie 19830505) and the client
presents this cookie in later requests (cookie 19830505)then the server matches the presented
cookie with server stored information and grants authentication remembering user preferences
and previous choices.

3
4.4 HTTP Content

4.5 Web Caching

A cache is a sort of "buffer" or temporary memory: somewhere a machine stores in its memory
some documents, so that when a request is asking for an already cached document (document
stored in the cache), we would rather send this document instead of making a complete (and
long) request to the server. This is very interesting for much requested documents; this can
reduce the network traffic.

The trick consists of knowing if the document has been updated. The following diagram shows
the route followed by a resource when performing a request on it:

4
Actually, the client makes its request to a proxy server or any other cache system. Then this
proxy is going to guess if the requested document (which is also in its cache) has been updated.
To do so, it is going to use the directives it got when it asked for the document for the first time.
If it knows nothing about the document, it may perform a HEAD request. According to the reply,
the proxy is able to know if it should ask for a new version or simply send the version it has in its
cache. Fortunately this latter case is the most frequent one, and therefore we save time and
network load.

4.6 The Conditional GET

HTTP/1.0 also introduces another nice cache feature: a conditional GET request. This is
performed with a special directive.

A conditional GET request will ask the server to send the document if and only if this document
has changed since the specified date. For the client, it is just a matter of sending the date at
which it last got the document. If the resource has not changed, the server just sends a very
short "HTTP/1.0 304 Not Modified" and the client simply uses the version it already has.

Summary

You have completed the fourth lesson of Module 2303: Computer Networks. Now you will be
having an indepth knowledge in HTTP. You will be able to explain about HTTP message format, Non
persistent and Persistent connections, Cookies, HTTP Content, Web Caching, and the conditional GET.

The next lesson will be on Introduction to Transport Layer services. Before moving to that
lesson, check your success of learning with Quiz 4.

Vous aimerez peut-être aussi