top of page

VIII-Hypertext Transfer Protocol (HTTP)

 

The hypertext Transfer Protocol is a World Wide Web (www) application-layer protocol.

It is implemented by two programs: a client program and a server program. The client

program and server program and server program execute in two different hosts but they

talk to each other by exchanging HTTP message. It is HTTP that defines the structure of

these messages and how the client and the server exchange messages. There are two

versions of HTTP that are still being used up to now the HTTP/1.0 and HTTP/1.1 HTTP

defines how web clients (browsers) request web pages from web servers, and how web

servers transfer web pages to web clients. A web page, also called document, consist of

objects. An object is simply a file, such as a Hypertext Markup Language (HTML) file, a

GIF image, a java applet, an audio clip, etc., that is addressable by single Universal

Resource Locator. (URL). A web page is usually composed of a base HTML file and

several referenced objects. For example, if a web page has four objects: the base HTML

file plus the three GIF images. A web client or browser is a user agent for the web. It

displays the requested web page implements the clients side of HTTP. The web server,

on the other hand, houses the web objects each addressable by URL. Web server side of

HTTP.

 

When a user requests a web page (done by clicking on a hyperlink), the browser sends

the HTTP request for objects in the web page to the web server. The web server receives

the request and responds with HTTP response messages, which includes the requested

objects. Figure 5-7 illustrates the general idea of HTTP requests and responses.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Both HTTP/ 1.0 and HTTP/ 1.1 run on top of TCP. The HTTP clients will first initiate a

TCP connection with the web server. Once the connection is established, the browser and

the server processes access TCP through their socket interfaces. There are, however, two

kinds of connections. HTTP/ 1.0 defaults to non- persistent connection while HTTP/ 1.1

defaults to persistent connection.

 

Consider the following steps in a non- persistent connection of transferring a web pages

from server to client:

 

1. The HTTP client initiates a TCP connection to the server www.uplb/edu.ph.

2. The HTTP client sends an HTTP request message into the TCP connection. The

request message is a request for the web page www /index.html.

3. The HTTP server receives the request, retrieves the object www/ index.html (may

come from the disk), encapsulates the objects in an HTTP response message, and

sends the response message into the TCP connection.

4. The HTTP server tells TCP to close the TCP connection after it receives an

acknowledgement that the client received the response message in correct form.

5. The HTTP client receives the response message. If correctly received, then the

TCP connection is terminated. The client extracts the file www/ index. Html from

the response message, parses the HTML files, and finds references to other

objects in the page.

6. The first four steps are then repeated for each of the referenced objects in the

page.

 

The steps above use non-persistent connections because each TCP connection is

closed after the server sends the objects, or the connection does not persist for

other objects. Thus, a web page with three GIF images (objects) will require four

TCP connections to be generated.

 

Non- persistent connections require a brand new connection to be established and

maintained for each requested objects. For each of these connections, TCP buffers

must be allocated and TCP variables must be kept in both the client and server.

This imposes a serious burden on the server, which may be serving hundreds of

 

different clients simultaneously. Moreover, each object requires two round trip

times (RTT’s) (the time it takes for small packet to travel from client to server

and then back to the client): one RTT to establish the TCP connection and one

RTT to request and receive an objects.

 

With persistent connections, the server leaves the TCP connections open after

sending responses. Subsequent request and response between the same client and

server can be sent over the same connection. This means the entire web page (the

base HTML file and several referenced objects) can be sent over persistent TCP

connection and multiple web pages residing on the same server can be sent over

the same TCP connection. When is a TCP connection closed? The normal

implementation is that the HTTP server closes the connection when the

connection is not used for a certain time period. (timeout time.)

 

There are two implementations of persistent connections: without pipeling and

with pipeling new request only when the previous response has been received. In

this case, each of the referenced objects experiences one RTT in order to request

and receive the object. In this case, each of the referenced object. Although this is

an improvement over the two RTT’s of non- persistent connections, the RTT

delay can still be reduced with pipelining. Another aspect of no pipelining that

can be improved is the fact that after a server sends an object over the persistent

TCP connection, the connection hangs (does nothing) while it waits for another

request to arrive. This obviously wastes the expensive bandwidth.

 

HTTP/ 1.1 uses persistent connections with pipelining. In this implementation, the

HTTP client issues a request as soon as if encounters a reference. Thus the HTTP

client can make the request back- to- back for the referenced objects. When the

server receives the requests, it can send the objects back-to-back. If all the

requests are sent back-to-back and all responses are sent back-to-back, then only

one RTT is expended for all referenced objects. The hang time of this

implementation is also much shorter.

 

bottom of page