Title: HyperText Transfer Protocol
1HyperText Transfer Protocol (HTTP)
RICHI GUPTA CISC 856 TCP/IP and Upper Layer
Protocols Fall 2007
Thanks to Dr. Amer, UDEL for some of the slides
used in this presentation Thanks to Madhusri
Nayak for some of the slides used in this
presentation
2Motivation ?
- Single informational network
- Light protocol
- Speed
Tim-Berners Lee Director of the W3C
HTTP Versions
Format HTTP/ltmajorgt.ltminorgt
- HTTP/0.9 No RFC
- HTTP/1.0 RFC 1945
- HTTP/1.1 RFC 2616
2
3Position of HTTP in the TCP/IP Protocol suite
HTTP
Application-layer
TCP
Transport layer
IGMP
ICMP
Network layer
IP
ARP
RARP
Data link layer
Underlying LAN or WAN
Physical layer
4Request Response Protocol
TCP connection
5A-PDU format
Note Each line ends with cr lf control
characters.
6A-PDU format (contd)
7A-PDU format Contd
1xx Informational Continue (100) ,
Switching Protocols(101) 2xx Success - action
was successfully received, understood, and
accepted Created (201), Accepted (202), No
Content (204), OK (200) 3xx Redirection -
further action needed to complete request
Moved Permanently (301) , Moved Temporarily
(302), Not Modified (304) 4xx Client Error -
request contains bad syntax or cannot be
fulfilled Bad Request (400), Unauthorized
(401), Forbidden (403), Not Found (404) 5xx
Server Error - server failed to fulfill an
apparently valid request Internal Server
Error (500), Not Implemented (501), Bad Gateway
(502), Service Unavailable
(503)
8Example Of Request/Response
Note Headers are in ascii format.
94 variations of HTTP
- Nonpersistent with one connection
- Nonpersistent with parallel connections
- Persistent without pipelining
- Persistent with pipelining
10 Nonpersistent (HTTP /1.0 default)
11Client
Server
SYN
SYN-ACK
3-way handshake
ACK
Get web page
Web page
Web page transferred
Client parses HTML web page
Ack
Data
1.Found referenced object Image 1 2.
Found referenced object Image 2
12Nonpersistent (contd)
Ack
Data
13Key points
- Connection does not persist for other objects
- Connections are sequential
14Rough calculation for number of RTTS
Client
Server
Web Page
Can we reduce the number of RTTS?
Image 1
Image 2
Delay due to connection request/handshake
Delay Due to HTML Page Request
Time delay in RTTs 6
Delay Due to Object Request
15- Nonpersistent with parallel connections( browser
dependent)
16Client parses HTML web page
1. Referenced object Image 1 2.
Referenced object Image 2
Parallel connections
Ack
Data
17Rough calculation
Client
Server
Web page
Image1 Image2
Time delay in RTTs 4
Delay due to connection request/handshake
Delay due to HTML page request
Delay due to object request
18Disadvantages
- overhead of multiple TCP connections
- A busy server could end up with lots of
connections in the TIME-WAIT state - Seldom does each connection get past the
slow-start region - failure to use the full end-to-end available
bandwidth - extra time opening connections increases
user-perceived latency
Can HTTP be further improved?
19Persistent without pipelining
20Ack
Data
Note 1) Requests are sequential 2)
Timer is at application layer
20
21Rough calculation
Client
Server
Web page
Image1
Image2
Time delay in RTTs 4
Delay due to connection request/handshake
Delay due to HTML page request
Delay due to object request
22Persistent with pipelining
23Back to back requests
Client parses web page Gets Image 1 Gets Image
2
Ack
Data
24Rough calculation
Client
Server
Web page
24
Image1 Image2
Time delay in RTTs 3
Delay due to connection request/handshake
Delay due to HTML page request
Delay due to object request
25- Advantages
- fewer connections
- Reduced network traffic
- CPU time is saved in routers and hosts
- Reduced perceived latency on subsequent requests
- Either client or server can close the
connection -
- Disadvantages
- Connections stay open longer at the server
26FTP vs HTTP
27Experimental Results
(NP HTTP/1.0) without parallel connections
(Persistent without pipelining)
(Persistent with pipelining)
Network Latency (seconds)
Number of in lined images
Figure 6-1 Latencies for a remote server, image
size 2544 bytes
28Experimental Results (contd)
(NP HTTP/1.0) without parallel connections
(Persistent without pipelining)
(Persistent with pipelining)
Network Latency (seconds)
Number of in lined images
Figure 6-2 Latencies for a remote server, image
size 45566 bytes
29Cache
Proxy Servers
HTTP Request (MISS)
HTTP Request
HTTP Response
HTTP Response(HIT)
- Eliminate the need to send
- requests to origin servers
- reduces the number of
- network round-trips
- expiration mechanism
- Eliminate the need to send full
- responses
- reduces network bandwidth
- requirements
- validation mechanism
HTTP Request
30- Expiration Model
- Explicit expiration times (expires / max-age
directive ). - Heuristic expiration times
- Validation model
- Cache validators (e.g Last-Modified Dates )
- Server attaches validator with full response
- user agent or proxy cache includes the
associated validator in - request
- The server then checks the validator
- Special status code (304 (Not modified))
- Full response
31What Clients control
What servers control
- Cachable/non-cachable object
- Cachable at proxy
- Cached object expiration time
- Operations performed on copy
- max-age age is no greater than the specified .
- min-fresh fresh for at least the specified
number of seconds - max-stale exceeded its expiration time by no
more than the specified number of seconds.
32Content negotiation
- Multiple representations (variants) of a single
resource - The process of selecting the best representation
for a given response - Types
- Server-driven Negotiation
- Selection algorithm located at server
- Agent-driven Negotiation
- Selection done by the user agent from the list
of available representations within header fields
or entity-body of initial response - This negotiation is performed in 2 steps
- Transparent Negotiation
- Combination of both server-driven and
agent-driven negotiation
33Messages for www.google.com
Request Header
GET / HTTP/1.1 User-Agent Mozilla/5.0 (Windows
U Windows NT 6.0 en-US rv1.8.1.7)
Gecko/20070914 Firefox/2.0.0.7 Host
www.google.com Accepttext/xml,application/xml,app
lication/xhtmlxmltext/htmlq0.9,text/plainq0.
8,image/png,/q0.5 Accept-Language
en,en-usq0.5q0.5 Accept-Encoding
none Accept-Charset ISO-8859-1,utf-8q0.7,q0.
7 Connection Keep-Alive
Response Header
HTTP/1.1 200 OK Cache-Control private Content-Typ
e text/html charsetUTF-8 Set-Cookie
PREFIDb77cac251a771420TM1191977279LM11919772
79SrI0Vm3o4ZErGKlM8 expiresFri, 09-Oct-2009
004759 GMT path/ domain.google.com Server
gws Content-Length 5471 Date Wed, 10 Oct 2007
004759 GMT
34Summary 4 variations of HTTP
- Nonpersistent with 1 connection
- One TCP connection at a time
- Server initiates connection close
- Nonpersistent with parallel connections
- More than one TCP connection at a time
- Server initiates connection close
- Persistent without pipelining
- One TCP connection at a time
- Sequential requests of embedded web page objects
- Server or client initiates connection close
- Persistent with pipelining
- One TCP connection at a time
- Back to back requests for embedded web page
objects - Server or client initiates connection close
35Questions?
Do you know? IE will only open 2 parallel HTTP
connections to a named server by default
Do you know? Firefox will open 4 parallel HTTP
connections to a named server by default
Do you know? Pipelining is implemented entirely
at the browser end.
Thanks