Internet and Web Lecture 6

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Internet and Web Technology

ICT- 2205
Lecture - 6

Presented By:
Mehrin Anannya
Lecturer
Institute of Information Technology
Jahangirnagar University.
Contents
Hyper Text Transfer Protocol

Fundamental Characteristics of HTTP Protocol

Hyper Text Transfer Protocol Version

Hyper Text Transfer Protocol Connections


Hyper Text Transfer Protocol
Web browsers interact with web servers with a simple application-level protocol called
HTTP (Hypertext Transfer Protocol), which runs on top of TCP/IP network connections.

HTTP is a client-server protocol that defines how messages are formatted and transmitted,
and what action web servers and browsers should take in response to various commands.

For example, when the user enters an URL in the browser, the browser sends an HTTP
command to the web server directing it to fetch and transmit the requested web page.
Fundamental characteristics of HTTP protocol
The HTTP protocol uses the request/response paradigm, which is an HTTP client program
sends an HTTP request message to an HTTP server that returns an HTTP response message.
Ex: email.

A typical Web paradigm using the request/response HTTP.

HTTP is a pull protocol; the client pulls information from the server (instead of server pushing
information down to the client).
Fundamental characteristics of HTTP protocol (cont.)

HTTP is a stateless protocol, that is, each request-response exchange is treated independently.
Clients and servers are not required to retain a state. An HTTP transaction consists of a single
request from a client to a server, followed by a single response from the server back to the
client. The server does not maintain any information about the transaction. Some transactions
require the state to be maintained, for example, a movie ticket booking web site( the state is
maintained using proxies and cookies which will be discussed later).
Fundamental characteristics of HTTP protocol (cont.)

HTTP is media independent. Any type of data can be sent by HTTP if both the client and
the server know how to handle the data content. It is required for the client as well as the
server to specify the content type using appropriate MIME-type (Multipurpose Internet
Mail Extensions type-text/html for normal web pages. text/plain for plain
text. application/octet-stream meaning “download this file”).
Hypertext Transfer Protocol Version
HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT :

HTTP uses a <major>.<minor> numbering scheme to indicate versions of the protocol.

The version of an HTTP message is indicated by an HTTP-Version field in the first line.

The initial version of HTTP was referred to as HTTP/0.9, which was a simple protocol for
raw data transfer across the Internet.

HTTP/1.0, as defined by RFC (Request for Comments) 1945, improved the protocol.
Hypertext Transfer Protocol Version (cont.)
HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT (cont.) :

In 1997, HTTP/1.1 was formally defined, and is currently an Internet Draft Standard
[RFC-2616].

Essentially all operational browsers and servers support HTTP/1.1( we will learn about it
here).

The latest version of HTTP, HTTP/2.0, was released in 2015. According to W3Techs, as
of June 2016, 8.4% of the top 10 million websites are supported by HTTP/2 (originally
named HTTP/2.0) (little bit of it will be known in the next slide).
Hypertext Transfer Protocol Connections
How a client will communicate with the server depends on the type of connection established
between the two machines.

Thus, an HTTP connection can either be persistent or non-persistent.


Hypertext Transfer Protocol Connections (cont.)
Non-persistent HTTP :

Non-persistent HTTP was used by HTTP/1.0.

In it only one object can be sent over a TCP connection. It transmits file from one machine to
other and required two Round Trip Time (RTT)—the time taken to send a small packet to
travel from client to server and back:

❖ One RTT to initiate TCP connection

❖ Second for HTTP request and first few bytes of HTTP response to return

❖ Rest of the time is taken in transmitting the file

While using non-persistent HTTP, the operating system has an extra overhead for maintaining
each TCP connection, as a result many browsers often open parallel TCP connections to fetch
referenced objects.
Hypertext Transfer Protocol Connections (cont.)
Non-persistent HTTP (cont.) :

The steps involved in setting up of a connection with non-persistent HTTP are:

1. Client (Browser) initiates a TCP connection to www.anyCollege.edu (Server):

Handshake.

2. Server at host www.anyCollege.edu accepts connection and acknowledges.

3. Client sends HTTP request for file /someDir/file.html.

4. Server receives message, finds and sends file in HTTP response.

5. Client receives response. It terminates connection, parseObject.

6. Steps 1–5 are repeated for each embedded object.


Hypertext Transfer Protocol Connections (cont.)
Non-persistent HTTP (cont.) :

RTT in a non-persistent HTTP.


Hypertext Transfer Protocol Connections (cont.)

Persistent HTTP :

To overcome the issues of HTTP/1.0, HTTP/1.1 came with persistent connections through
which multiple objects can be sent over a single TCP connection between the client and server.

The server leaves the connection open after sending the response, so subsequent HTTP
messages between same client/server are sent over the open connection.

Persistent connection also overcomes the problem of slow start as in non-persistent each object
transfer suffers from slow start, and overall number of RTTs required for persistent is much
less than in non-persistent
Hypertext Transfer Protocol Connections (cont.)

Persistent HTTP (cont.) :

The steps involved in setting the connection of non-persistent HTTP are:

1. Client (Browser) initiates a TCP connection to www.anyCollege.edu (Server):


Handshake.
2. Server at host www.anyCollege.edu accepts connection and acknowledges.
3. Client sends HTTP request for file /someDir/file.html.
4. Server receives request, finds and sends object in HTTP response.
5. Client receives response. It terminates connection, parseobject.
6. Steps 3–5 are repeated for each embedded object.
Hypertext Transfer Protocol Connections (cont.)

Persistent HTTP (cont.) :

RTT in a persistent HTTP.


Hypertext Transfer Protocol Connections (cont.)

Thus, the overhead of HTTP/1.0 is 1 RTT for each start (each request/response), that is if there
are 10 objects, then the Total Transmission Time is as follows:

TTT = [10 * 1 TCP/RTT] + [10 * 1 REQ/RESP RTT] = 20RTT

Whereas for HTTP/1.1, persistent connections1 are very helpful with multi-object requests as
the server keeps TCP connection open by default.

TTT = [1 * 1 TCP/RTT] + [10 * 1 REQ/RESP RTT] = 11 RTT

The visible advantages of a persistent connection include, saving of CPU time in routers and
hosts, and the reduction in network congestion and latency on subsequent requests.
Hypertext Transfer Protocol Connections (cont.)

Persistent HTTP connections are used with or without pipelining.

In persistent connections without pipelining, the client issues a new request only after the
previous response has arrived. Whereas, in persistent connections with pipelining, the client
sends the request as soon as it encounters a reference, i.e., multiple requests/responses.

HTTP/1.1 supports pipelining—it allows clients to send multiple requests at once, without
waiting for a reply.
Hypertext Transfer Protocol Connections (cont.)

Servers can also send multiple replies without closing their socket. This results in fewer round
trips and faster load times. This is particularly useful for satellite Internet connections and
other connections with high latency as separate requests need not be made for each file.

Since it is possible to fit several HTTP requests in the same TCP packet, HTTP pipelining
allows fewer TCP packets to be sent over the network, reducing network load.

HTTP pipelining requires both the client and the server to support it.
Summary
HTTP has HTTP/1.0, HTTP/1.1 (very widely used) and HTTP/2.

HTTP uses persistent and non-persistent connections to transfer data.


Next Topic
Hyper Text Transfer Protocol Communication

HTTP Request Message Format

You might also like