You are on page 1of 28

HTTP

Lesson 4 - 5

ITE 3304
Network Design, Applications and Management
Outline
• Brief History of WWW
• Architecture
• HTTP Connections
• HTTP Format
• Web Performance
• Cookies

ITE 3304 - Network Design, Applicat 2


ions and Management
History of the Web
• World Wide Web, “Web”, “WWW”
• Tim Berners-Lee at CERN in 1991
– Demonstrated prototype at a conf. in ’91
– Text-based
• Marc Andreessen developed the first graphical
Web browser in 1993: Mosaic
• Andreessen founds Netscape Communications
• Browser war starts around 1995-96
• America Online buys Netscape in 1998

ITE 3304 - Network Design, Applicat 3


ions and Management
Some “Web” Terminology
• Web page may contain links to other pages
(sometimes also called Web Objects)
• Object can be HTML file, JPEG image, Java
applet, audio file,…
• Web pages are “Hypertexts”
– One page points to another
– Proposed by Prof. Vannevar Bush in 1945!
• Each object is addressable by a URL:

http://www.someschool.edu/someDept/pic.gif

protocol host name path name


ITE 3304 - Network Design, Applicat 4
ions and Management
Outline
• Brief History of WWW
• Architecture
• HTTP Connections
• HTTP Format
• Web Performance
• Cookies

ITE 3304 - Network Design, Applicat 5


ions and Management
HTTP overview
HTTP: hypertext
transfer protocol HT
TP
• Web’s application layer PC running HT
equ r
est
protocol TP
Explorer res
pon
se
• client/server model
– client: browser that st
u e
requests, receives, P r eq se Server
T o n
“displays” Web objects HT r es
p running
T P Apache Web
– server: Web server HT
server
sends objects in
response to requests Mac running
Navigator
• HTTP 1.0: RFC 1945
• HTTP 1.1: RFC 2616
ITE 3304 - Network Design, Applicat 6
ions and Management
HTTP overview (continued)
Uses TCP: HTTP is “stateless”
• client initiates TCP • server maintains no
connection (creates information about past
socket) to server, port 80 client requests
• server accepts TCP
connection from client aside
• HTTP messages Protocols that maintain
(application-layer protocol “state” are complex!
messages) exchanged • past history (state) must be
between browser (HTTP maintained
client) and Web server
(HTTP server) • if server/client crashes,
their views of “state” may
• TCP connection closed
be inconsistent, must be
reconciled
ITE 3304 - Network Design, Applicat 7
ions and Management
Outline
• Brief History of WWW
• Architecture
• HTTP Connections
• HTTP Format
• Web Performance
• Cookies

ITE 3304 - Network Design, Applicat 8


ions and Management
HTTP connections
Non-persistent HTTP Persistent HTTP
• At most one object is • Multiple objects can be
sent over single TCP
sent over a TCP connection between
connection. client and server.
• HTTP/1.0 uses non- • HTTP/1.1 uses
persistent HTTP persistent connections
in default mode
– Pipelined
– Non-pipelined

ITE 3304 - Network Design, Applicat 9


ions and Management
Response time modeling
Definition of RTT: time to
send a small packet to
travel from client to server
and back. initiate TCP
Response time: connection
RTT
• one RTT to initiate TCP
request
connection file
• one RTT for HTTP RTT
time to
transmit
request and first few bytes file
of HTTP response to file
received
return
• file transmission time time time
total = 2RTT+transmit time
ITE 3304 - Network Design, Applicat 10
ions and Management
Classical HTTP/1.0
initiate TCP
connection
http://www.somewhere.com/index.html
RTT index.html references: page1.jpg,
page2.jpg, page3.jpg.
GET index.html
time to
RTT
transmit index.hml

file
received

GET page1.jpg

time to
transmit page1.jpg

ITE 3304 - Network Design, Applicat 11


ions and Management
Persistent HTTP

Nonpersistent HTTP issues:


• requires 2 RTTs per object
• OS must work and allocate host resources for each TCP
connection
• but browsers often open parallel TCP connections to
fetch referenced objects
Persistent HTTP
• server leaves connection open after sending response
• subsequent HTTP messages between same
client/server are sent over connection

ITE 3304 - Network Design, Applicat 12


ions and Management
Persistent HTTP
• Persistent without pipelining:
– client issues new request only when previous
response has been received
– one RTT for each referenced object
• Persistent with pipelining:
– default in HTTP/1.1
– client sends requests as soon as it
encounters a referenced object
– as little as one RTT for all the referenced
objects
ITE 3304 - Network Design, Applicat 13
ions and Management
Outline
• Brief History of WWW
• Architecture
• HTTP Connections
• HTTP Format
• Web Performance
• Cookies

ITE 3304 - Network Design, Applicat 14


ions and Management
HTTP request message
• HTTP request message:
– ASCII (human-readable format)

request line
(GET, POST, GET /somedir/page.html HTTP/1.1
HEAD commands) Host: www.someschool.edu
User-agent: Mozilla/4.0
header Connection: close
lines Accept-language:fr

Carriage return,
line feed (extra carriage return, line feed)
indicates end
of message ITE 3304 - Network Design, Applicat 15
ions and Management
HTTP request message: general format

ITE 3304 - Network Design, Applicat 16


ions and Management
HTTP Methods
• GET: retrieve a file (95% of requests)
• HEAD: just get meta-data (e.g., mod time)
• POST: submitting a form to a server
• PUT: store enclosed document as URI
• DELETE: removed named resource
• LINK/UNLINK: in 1.0, gone in 1.1
• TRACE: http “echo” for debugging (added in 1.1)
• CONNECT: used by proxies for tunneling (1.1)
• OPTIONS: request for server/proxy options (1.1)

ITE 3304 - Network Design, Applicat 17


ions and Management
HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK
status phrase) Connection: close
Date: Thu, 06 Aug 1998 12:00:15 GMT
header Server: Apache/1.3.0 (Unix)
lines Last-Modified: Mon, 22 Jun 1998 …...
Content-Length: 6821
Content-Type: text/html

data, e.g., data data data data data ...


requested
HTML file

ITE 3304 - Network Design, Applicat 18


ions and Management
HTTP Response Status Codes
• 1XX: Informational (def’d in 1.0, used in 1.1)
100 Continue, 101 Switching Protocols
• 2XX: Success
200 OK, 206 Partial Content
• 3XX: Redirection
301 Moved Permanently, 304 Not Modified
• 4XX: Client error
400 Bad Request, 403 Forbidden, 404 Not Found
• 5XX: Server error
500 Internal Server Error, 503 Service
Unavailable, 505 HTTP Version Not Supported

ITE 3304 - Network Design, Applicat 19


ions and Management
Trying out HTTP (client side) for yourself

1. Telnet to your favorite Web server:


telnet www.uom.lk 80 Opens TCP connection to port 80
(default HTTP server port) at www.uom.lk.
Anything typed in sent
to port 80 at www.uom.lk

2. Type in a GET HTTP request:


GET index.html HTTP/1.0 By typing this in (hit carriage
return twice), you send
this minimal (but complete)
GET request to HTTP server

3. Look at response message sent by HTTP server!

ITE 3304 - Network Design, Applicat 20


ions and Management
Outline
• Brief History of WWW
• Architecture
• HTTP Connections
• HTTP Format
• Web Performance
• Cookies

ITE 3304 - Network Design, Applicat 21


ions and Management
Web Proxy Caching
Objective: satisfy client request without involving origin server
resulting in reduced server & network load, low latency to
response
origin
• user sets browser: server
Web accesses via Proxy
cache HT
TP
req server q uest
H u P re
• browser sends all T
client TP e st T T o n se
H p
HTTP requests to
res
pon P r es
se H TT
cache u e st
– object in cache => P r eq nse
T p o
cache hit: returns HT r es
object T TP
H
– else cache requests
object from origin client
server, then returns Cache acts as both client and server origin
object to client server

ITE 3304 - Network Design, Applicat 22


ions and Management
Web Caching Hierarchy
national/international proxy cache

regional proxy cache

local proxy cache


(e.g., local ISP,
University)

client
ITE 3304 - Network Design, Applicat 23
ions and Management
Why Cache?
• Reduce response time for client request.
• Reduce traffic on an institution’s access
link.
• Internet dense with caches enables “poor”
content providers to effectively deliver
content

ITE 3304 - Network Design, Applicat 24


ions and Management
Outline
• Brief History of WWW
• Architecture
• HTTP Connections
• HTTP Format
• Web Performance
• Cookies

ITE 3304 - Network Design, Applicat 25


ions and Management
Cookies: keeping “state”
Many major Web sites
use cookies Example:
Four components: – Susan access Internet
always from same PC
1) cookie header line in the
HTTP response – She visits a specific e-
message commerce site for first
2) cookie header line in time
HTTP request message – When initial HTTP
3) cookie file kept on user’s requests arrives at site,
host and managed by site creates a unique ID
user’s browser and creates an entry in
4) back-end database at backend database for ID
Web site
ITE 3304 - Network Design, Applicat 26
ions and Management
Cookies: keeping “state” (cont.)
client server
Cookie file usual http request msg server ne
da try i
tab n b
usual http response + creates ID as ac
e ke
ebay: 8734 Set-cookie: 1678 1678 for user nd

Cookie file
usual http request msg
amazon: 1678 cookie: 1678 cookie- ss
ebay: 8734 specific acce
usual http response msg action

ss
one week later:

ce
ac
usual http request msg
Cookie file cookie-
cookie: 1678
amazon: 1678 spectific
ebay: 8734 usual http response msg action

ITE 3304 - Network Design, Applicat 27


ions and Management
Cookies (continued)
aside
What cookies can Cookies and privacy:
bring: • cookies permit sites to
learn a lot about you
• authorization
• you may supply name
• shopping carts and e-mail to sites
• recommendations • search engines use
• user session state redirection & cookies to
learn yet more
(Web e-mail)
• advertising companies
obtain info across sites

ITE 3304 - Network Design, Applicat 28


ions and Management

You might also like