0% found this document useful (0 votes)
60 views

Web and HTTP: Application Layer 2-1

The document discusses the Web and HTTP protocol. It begins with an overview of how web pages consist of objects like HTML files and images that are referenced and addressable via URLs. It then provides an overview of the HTTP protocol, noting that it is the application layer protocol of the web and uses a client-server model. It describes how HTTP uses TCP for reliable connections between clients and servers. It then contrasts non-persistent and persistent HTTP, noting that persistent HTTP allows multiple objects to be sent over a single TCP connection to improve performance.

Uploaded by

Waqas Maan
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Web and HTTP: Application Layer 2-1

The document discusses the Web and HTTP protocol. It begins with an overview of how web pages consist of objects like HTML files and images that are referenced and addressable via URLs. It then provides an overview of the HTTP protocol, noting that it is the application layer protocol of the web and uses a client-server model. It describes how HTTP uses TCP for reliable connections between clients and servers. It then contrasts non-persistent and persistent HTTP, noting that persistent HTTP allows multiple objects to be sent over a single TCP connection to improve performance.

Uploaded by

Waqas Maan
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 22

Web and HTTP

Application Layer 2-1


Application Layer 2-2
Web and HTTP
First, a review…
 web page consists of objects
 object can be HTML file, JPEG image, Java applet,
audio file,…
 web page consists of base HTML-file which
includes several referenced objects
 each object is addressable by a URL, e.g.,
www.someschool.edu/someDept/pic.gif

host name path name

Application Layer 2-3


HTTP overview
HTTP: hypertext
transfer protocol
 Web’s application layer
protocol PC running
 client/server model Firefox browser

 client: browser that


requests, receives,
(using HTTP protocol) server
and “displays” Web running
objects Apache Web
 server: Web server server
sends (using HTTP
protocol) objects in iphone running
response to requests Safari browser

Application Layer 2-4


HTTP Protocol Application Layer
UDP/TCP Protocol Transport Layer
Network Layer
Data Link Layer
Physical Layer

Application Layer 2-5


Client Server
HTTP Protocol Application Layer Application Layer HTTP Protocol
TCP Protocol Transport Layer Transport Layer TCP Protocol
Network Layer Network Layer
Data Link Layer Data Link Layer
Physical Layer Physical Layer

Application Layer 2-6


Connection Oriented

Application Layer 2-7


HTTP overview (continued)
uses TCP:
 client initiates TCP
connection (creates
socket) to server, port 80
 server accepts TCP
connection from client
 HTTP messages
(application-layer protocol
messages) exchanged
between browser (HTTP
client) and Web server
(HTTP server)
 TCP connection closed

Application Layer 2-8


HTTP connections
non-persistent HTTP persistent HTTP
 at most one object  multiple objects can
sent over TCP be sent over single
connection TCP connection
 connection then between client, server
closed
 downloading multiple
objects required
multiple connections

Application Layer 2-9


Non-persistent HTTP
suppose user enters URL: (contains text,
www.someSchool.edu/someDepartment/home.index references to 10
jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server
(process) at 1b. HTTP server at host
www.someSchool.edu on port www.someSchool.edu waiting
80 for TCP connection at port 80.
“accepts” connection, notifying
2. HTTP client sends HTTP request client
message (containing URL) into
TCP connection socket. 3. HTTP server receives request
Message indicates that client message, forms response
wants object message containing requested
someDepartment/home.index object, and sends message into
its socket
time
Application Layer 2-10
Non-persistent HTTP (cont.)
4. HTTP server closes TCP
connection.
5. HTTP client receives response
message containing html file,
displays html. Parsing html file,
finds 10 referenced jpeg objects

time
6. Steps 1-5 repeated for each of
10 jpeg objects

Application Layer 2-11


Non-persistent HTTP: response time

RTT (definition): time for a


small packet to travel from
client to server and back
HTTP response time: initiate TCP
 one RTT to initiate TCP
connection

connection RTT

 one RTT for HTTP request


request
file
and first few bytes of HTTP RTT
time to
response to return transmit
file
 file transmission time file
received
 non-persistent HTTP
response time =
time time
2RTT+ file transmission
time

Application Layer 2-12


Persistent HTTP

non-persistent HTTP issues: persistent HTTP:


 requires 2 RTTs per object  server leaves connection
 OS overhead for each TCP open after sending
connection response
 browsers often open  subsequent HTTP
parallel TCP connections messages between same
to fetch referenced objects client/server sent over
open connection
 client sends requests as
soon as it encounters a
referenced object
 as little as one RTT for all
the referenced objects

Application Layer 2-13


HTTP request message

 two types of HTTP messages: request, response


 HTTP request message:
 ASCII (human-readable format)
carriage return character
line-feed character
request line
(GET, POST, GET /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\r\n
User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n
header Accept-Language: en-us,en;q=0.5\r\n
lines Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
carriage return, Keep-Alive: 115\r\n
line feed at start Connection: keep-alive\r\n
\r\n
of line indicates
end of header lines
Application Layer 2-14
HTTP request message: general format

method sp URL sp version cr lf request


line
header field name value cr lf
header
~
~ ~
~ lines

header field name value cr lf


cr lf

~
~ entity body ~
~ body

Application Layer 2-15


Uploading form input
POST method:
 web page often includes
form input
 input is uploaded to
server in entity body

URL method:
 uses GET method
 input is uploaded in URL
field of request line:
www.somesite.com/animalsearch?monkeys&banana

Application Layer 2-16


Method types
HTTP/1.0: HTTP/1.1:
 GET  GET, POST
 POST  PUT
 uploads file in entity
body to path specified
in URL field
 DELETE
 deletes file specified in
the URL field

Application Layer 2-17


HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK\r\n
status phrase) Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\n
header ETag: "17dc6-a5c-bf716880"\r\n
Accept-Ranges: bytes\r\n
lines Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: text/html; charset=ISO-8859-
1\r\n
\r\n
data, e.g., data data data data data ...
requested
HTML file
Application Layer 2-18
HTTP response status codes
 status code appears in 1st line in server-to-
client response message.
 some sample codes:
200 OK
 request succeeded, requested object later in this msg
301 Moved Permanently
 requested object moved, new location specified later in this msg
(Location:)
400 Bad Request
 request msg not understood by server
404 Not Found
 requested document not found on this server
505 HTTP Version Not Supported
Application Layer 2-19
Web caches (proxy server)
goal: satisfy client request without involving origin server
 user sets browser: Web
accesses via cache
 browser sends all HTTP proxy
requests to cache server
 object in cache: cache client
origin
returns object server
 else cache requests
object from origin
server, then returns
object to client
client origin
server

Application Layer 2-20


More about Web caching
 cache acts as both why Web caching?
client and server  reduce response time
 server for original for client request
requesting client
 client to origin server  reduce traffic on an
 typically cache is institution’s access link
installed by ISP  Internet dense with
(university, company, caches: enables “poor”
residential ISP) content providers to
effectively deliver
content (so too does
P2P file sharing)

Application Layer 2-21


Conditional GET
client server
 Goal: don’t send object if
cache has up-to-date
cached version HTTP request msg
object
If-modified-since: <date>
 no object transmission not
delay modified
 lower link utilization HTTP response
before
HTTP/1.0
 cache: specify date of 304 Not Modified
<date>
cached copy in HTTP
request
If-modified-since:
<date> HTTP request msg
 server: response contains If-modified-since: <date> object
modified
no object if cached copy after
HTTP response
is up-to-date: HTTP/1.0 200 OK <date>
HTTP/1.0 304 Not <data>
Modified
Application Layer 2-22

You might also like