Lec 02 Application Layer
Lec 02 Application Layer
Application Layer
07/31/2024
Internet applications
07/31/2024
Application layer
07/31/2024
Creating a network app application
transport
network
data link
clients:
communicate with server
client/server
may be intermittently
connected
may have dynamic IP
addresses
do not communicate directly
with each other
application application
socket controlled by
process process app developer
transport transport
network network controlled
link
by OS
link Internet
physical physical
Application-layer protocols
one piece of an application
define messages exchanged by applications and & actions taken
implementing services by using the service provided by lower
layers
07/31/2024
App-layer protocol defines
types of messages open protocols:
exchanged, defined in RFCs
e.g., request, response allows for interoperability
message syntax: e.g., HTTP, SMTP
what fields in messages proprietary protocols:
& how fields are e.g., Skype
delineated
message semantics
meaning of information
in fields
rules for when and how
processes send & respond
to messages
application underlying
application layer protocol transport protocol
07/31/2024
The Web: Some Jargon
Web page
consists of objects (HTML file, JPEG image, GIF image…)
addressed by URL
Most Web pages consist of
base HTML page
several referenced objects
URL
A standard way of specifying the location of an object, typically
a web page, on the Internet
User agent for Web is called a browser
MS Internet Explorer
Server for Web is called a Web server
07/31/2024
HyperText Transfer Protocol
Web’s application layer protocol
Used to access data on the World Wide Web
Rapid jump from one document to another
Client-server model
client: browser that requests, receives, “displays” web objects
server: Web server sends objects in response to request
uses one TCP connection on the well-known port 80
07/31/2024
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
method
protocol used to retrieve the document (FTP, HTTP, …)
host
a computer where the info is located
the name of the computer can be an alias (not necessary
www)
port
optional port # of the server
path
the path name of the file where the info is located
Figure 27.1 Architecture of WWW
27.25
Figure 27.2 Browser
27.26
27-2 WEB DOCUMENTS
27.27
Figure 27.4 Static document
27.28
Figure 27.6 Effect of boldface tags
27.29
Figure 27.8 Dynamic document using CGI
27.30
Figure 27.9 Dynamic document using server-site script
27.31
HTTP overview
HTTP: hypertext transfer
protocol HT
Web’s application layer TP
req
protocol PC running ues
HT t
Firefox browser TPr
client/server model esp
ons
client: browser that e
requests, receives, t
(using HTTP protocol) u es
req server
and “displays” Web T P nse
HT po running
objects P res
Apache Web
T
server: Web server HT server
sends (using HTTP
protocol) objects in iphone running
response to requests Safari browser
time
6. Steps 1-5 repeated for each of 10
jpeg objects
response time =
2RTT+ file transmission time time
time
Non-persistent Persistent
HTTP/1.0 default for HTTP/1.1
requires 2 RTTs per object server leaves connection
OS overhead for each open after sending
TCP connection response
browsers often open subsequent HTTP
Use carefully
POST requests should not be pipelined (changes server state)
GET/HEAD requests are usually okay
39
Persistent HTTP
Non-persistent HTTP issues: Persistent without pipelining:
Connection setup for each Client issues new request only
request when previous response has
But browsers often open been received
parallel connections One RTT for each object
40
“Persistent without pipelining”
most common
When does pipelining work best?
Small objects, equal time to serve each object
• Because pipelining simply removes additional 1 RTT delay to
request new content
41
HTTP – message format
two types of messages: request & response
ASCII (human-readable format)
07/31/2024
HTTP protocol – message format
HTTP request message
HTTP 0.9
HTTP 1.0
HTTP 1.1
07/31/2024
Method types
HTTP/1.0: HTTP/1.1:
GET GET, POST, HEAD
POST PUT
HEAD uploads file in entity
asks server to leave body to path specified
requested object out of in URL field
response DELETE
i.e. request info about a deletes file specified in
doc the URL field
27.47
HTTP – message format
Headers
exchange additional information between the client & the
server
example
• doc in a special format
• extra info about document
07/31/2024
HTTP – message format- headers
27.49
HTTP – message format
27.51
HTTP – message format
Table 27.6 Entity headers
27.52
HTTP messages – an example
URL method:
uses GET method
input is uploaded in URL
field of request line:
www.somesite.com/animalsearch?monkeys&banana
ebay 8734
usual http request msg Amazon server
cookie file creates ID
usual http response
1678 for user create backend
ebay 8734
set-cookie: 1678 entry database
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
usual http response msg action
proxy
user sets browser: Web HT
TP u est
req server req
accesses via cache HT
client TP
ues
t H TTP
o nse
res p origin
browser sends all HTTP pon P res
se T server
HT
requests to cache ues
t
req e
object in cache: cache TT P
po ns
H es
returns object T TP
r
H
else cache requests
object from origin client origin
server, then returns server
object to client
Application Layer 2-60
More about Web caching
cache acts as both why Web caching?
client and server reduce response time for
server for original 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)
07/31/2024
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
no object if cached copy modified
HTTP response after
is up-to-date:
HTTP/1.0 200 OK <date>
HTTP/1.0 304 Not
Modified <data>
Application Layer 2-67
Chapter 2: outline