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

Lecture6 7

Uploaded by

Ciyene Lekaota
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Lecture6 7

Uploaded by

Ciyene Lekaota
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Remove Watermark Wondershare

PDFelement

CNT122

Application layer protocols -HTTP

CNT122 -- Computer Communications and Networks I 1


Remove Watermark Wondershare
PDFelement

App-layer protocol defines


 Types of messages Public-domain protocols:
exchanged,  defined in RFCs
 e.g., request, response
 allows for
 Message syntax:
interoperability
 what fields in messages &
how fields are delineated  e.g., HTTP, SMTP

 Message semantics Proprietary protocols:


 meaning of information in  e.g., Skype
fields
 Rules for when and how
processes send &
respond to messages

CNT122 -- Computer Communications and Networks I 2


Remove Watermark Wondershare
PDFelement

What transport service does an app need?


Data loss Throughput
 some apps (e.g., audio) can  some apps (e.g.,
tolerate some loss multimedia) require
 other apps (e.g., file minimum amount of
transfer, telnet) require throughput to be
100% reliable data “effective”
transfer
 other apps (“elastic apps”)
Timing make use of whatever
 some apps (e.g., throughput they get
Internet telephony,
interactive games) Security
require low delay to be  Encryption, data
“effective” integrity, …

CNT122 -- Computer Communications and Networks I 3


Remove Watermark Wondershare
PDFelement

Transport service requirements of common apps

Application Data loss Throughput Time Sensitive

file transfer no loss elastic no


e-mail no loss elastic no
Web documents no loss elastic no
real-time audio/video loss-tolerant audio: 5kbps-1Mbps yes, 100’s msec
video:10kbps-5Mbps
stored audio/video loss-tolerant same as above yes, few secs
interactive games loss-tolerant few kbps up yes, 100’s msec
instant messaging no loss elastic yes and no

CNT122 -- Computer Communications and Networks I 4


Remove Watermark Wondershare
PDFelement

Internet transport protocols services


TCP service:
UDP service:
 connection-oriented: setup
 unreliable data transfer
required between client and
between sending and
server processes
receiving process
 reliable transport between
 does not provide:
sending and receiving process
connection setup,
 flow control: sender won’t reliability, flow control,
overwhelm receiver congestion control, timing,
 congestion control: throttle throughput guarantee, or
sender when network security
overloaded
 does not provide: timing, Q: why bother? Why is
minimum throughput there a UDP?
guarantees, security
CNT122 -- Computer Communications and Networks I 5
Remove Watermark Wondershare
PDFelement

Internet apps: application, transport protocols

Application Underlying
Application layer protocol transport protocol

e-mail SMTP [RFC 2821] TCP


remote terminal access Telnet [RFC 854] TCP
Web HTTP [RFC 2616] TCP
file transfer FTP [RFC 959] TCP
streaming multimedia HTTP (eg Youtube), TCP or UDP
RTP [RFC 1889]
Internet telephony SIP, RTP, proprietary
(e.g., Skype) typically UDP

CNT122 -- Computer Communications and Networks I 6


Remove Watermark Wondershare
PDFelement

Web and HTTP


First some jargon
 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
 Example URL:
www.someschool.edu/someDept/pic.gif

host name path name


CNT122-- Computer Communications and Networks I 7
Remove Watermark Wondershare
PDFelement

HTTP overview

HTTP: hypertext
transfer protocol
 Web’s application layer PC running
protocol Explorer

 client/server model
 client: browser that
requests, receives, Server
“displays” Web objects running
Apache Web
 server: Web server
server
sends objects in
response to requests
Mac running
Navigator

CNT122 -- Computer Communications and Networks 8


I
Remove Watermark Wondershare
PDFelement

Architectural Overview
 HTTP transfers pages from servers to
browsers

CS3441 -- Computer Communications and Networks 9


I
Remove Watermark Wondershare

Architectural Overview
PDFelement

 Pages are named with URLs (Uniform


Resource Locators)
 Example:
http://www.phdcomics.com/comics.php

Our
focus

Common URL protocols

CNT122-- Computer Communications and Networks 10


I
Remove Watermark Wondershare
PDFelement

Architectural Overview
Steps a client (browser) takes to follow a hyperlink:
• Determine the protocol (HTTP)
• Ask DNS for the IP address of server
• Make a TCP connection to server
• Send request for the page; server sends it back
• Fetch other URLs as needed to display the page
• Close idle TCP connections
Steps a server takes to serve pages:
• Accept a TCP connection from client
• Get page request and map it to a resource (e.g., file name)
• Get the resource (e.g., file from disk)
• Send contents of the resource to the client.
• Release idle TCP connections

CNT122--Computer Communications and Networks I 11


Remove Watermark Wondershare
PDFelement

HTTP overview (continued)


Uses TCP: HTTP is “stateless”
 client initiates TCP  server maintains no
connection (creates socket) information about
to server, port 80 past client requests
 server accepts TCP
connection from client aside
Protocols that maintain
 HTTP messages (application- “state” are complex!
layer protocol messages)  past history (state) must
exchanged between browser be maintained
(HTTP client) and Web
 if server/client crashes,
server (HTTP server)
their views of “state” may
 TCP connection closed
be inconsistent, must be
reconciled

CNT122- Computer Communications and Networks I 12


Remove Watermark Wondershare
PDFelement

HTTP connections
Nonpersistent HTTP Persistent HTTP
 At most one object is  Multiple objects can
sent over a TCP be sent over single
connection. TCP connection
between client and
server.

CNT1 -- Computer Communications and Networks I 13


Remove Watermark Wondershare
PDFelement

Nonpersistent HTTP
(contains text,
Suppose user enters URL references to 10
www.someSchool.edu/someDepartment/home.index jpeg images)

1a. HTTP client initiates TCP


connection to HTTP server
(process) at
1b. HTTP server at host
www.someSchool.edu waiting
www.someSchool.edu on port 80
for TCP connection at port 80.
“accepts” connection, notifying
client
2. HTTP client sends HTTP
request message (containing
URL) into TCP connection 3. HTTP server receives request
socket. Message indicates message, forms response
that client wants object message containing requested
someDepartment/home.index object, and sends message
into its socket

time
CNT122 -- Computer Communications and Networks I 14
Remove Watermark Wondershare
PDFelement

Nonpersistent 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

CNT122-- Computer Communications and Networks I 15


Remove Watermark Wondershare
PDFelement

Non-Persistent HTTP: Response time


Definition of RTT: time for
a small packet to travel
from client to server
and back.
initiate TCP
Response time: connection
 one RTT to initiate TCP RTT
connection request
file
 one RTT for HTTP RTT
time to
transmit
request and first few file
bytes of HTTP response file
received
to return
 file transmission time time time

total = 2RTT+transmit time


CNT122 -- Computer Communications and Networks I 16
Remove Watermark Wondershare
PDFelement

Persistent HTTP

Nonpersistent 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 parallel  subsequent HTTP messages
TCP connections to fetch between same
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

CNT122 -- Computer Communications and Networks I 17


Remove Watermark Wondershare
PDFelement

HTTP request message


 two types of HTTP messages: request, response
 HTTP request message:
 ASCII (human-readable format)

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

Carriage return, (extra carriage return, line feed)


line feed
indicates end
of message
CNT122- Computer Communications and Networks I 18
Remove Watermark Wondershare
PDFelement

HTTP request message: general format

CNT122 -- Computer Communications and Networks I 19


Remove Watermark Wondershare
PDFelement

Uploading form input


Post method: URL method:
 Web page often  Uses GET method
includes form input  Input is uploaded in
 Input is uploaded to URL field of request
server in entity body line:

www.somesite.com/animalsearch?monkeys&banana

CNT122 -- Computer Communications and Networks I 20


Remove Watermark Wondershare
PDFelement

Method types
HTTP/1.0 HTTP/1.1
 GET  GET, POST, HEAD
 POST  PUT
 HEAD  uploads file in entity
body to path specified
 asks server to leave
in URL field
requested object out of
response  DELETE
 deletes file specified in
the URL field

CNT122-- Computer Communications and Networks I 21


Remove Watermark Wondershare
PDFelement

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
Server: Apache/1.3.0 (Unix)
header
Last-Modified: Mon, 22 Jun 1998 …...
lines
Content-Length: 6821
Content-Type: text/html

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


requested
HTML file

CNT122 -- Computer Communications and Networks I 22


Remove Watermark Wondershare
PDFelement

HTTP response status codes


In first line in server->client response message.
A few sample codes:
200 OK
 request succeeded, requested object later in this message
301 Moved Permanently
 requested object moved, new location specified later in
this message (Location:)
400 Bad Request
 request message not understood by server
404 Not Found
 requested document not found on this server
505 HTTP Version Not Supported
CNT122 -- Computer Communications and Networks I 23
Remove Watermark Wondershare
PDFelement

User-server state: cookies


Many major Web sites Example:
use cookies  Susan always access
Four components: Internet always from PC
1) cookie header line of
HTTP response message  visits specific e-
2) cookie header line in commerce site for first
HTTP request message time
3) cookie file kept on  when initial HTTP
user’s host, managed by
user’s browser requests arrives at site,
4) back-end database at site creates:
Web site  unique ID
 entry in backend
database for ID
CNT122 -- Computer Communications and Networks I 24
Remove Watermark Wondershare
PDFelement

Cookies: keeping “state” (cont.)


client server
ebay 8734
usual http request msg
Amazon server
cookie file usual http response creates ID
Set-cookie: 1678 1678 for user create
ebay 8734 entry
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
usual http response msg action backend
one week later:
access database
ebay 8734 usual http request msg
amazon 1678 cookie: 1678 cookie-
spectific
usual http response msg action

CNT122 -- Computer Communications and Networks I 25


Remove Watermark Wondershare
PDFelement

Cookies (continued)
aside
What cookies can bring: Cookies and privacy:
 authorization  cookies permit sites to
 shopping carts
learn a lot about you
 you may supply name
 recommendations
and e-mail to sites
 user session state
(Web e-mail)
How to keep “state”:
 protocol endpoints: maintain state
at sender/receiver over multiple
transactions
 cookies: http messages carry state
CNT122 -- Computer Communications and Networks I 26
Remove Watermark Wondershare
PDFelement

Web caches (proxy server)


Goal: satisfy client request without involving origin server

 user sets browser: origin


server
Web accesses via
cache Proxy
 browser sends all server
client
HTTP requests to
cache
 object in cache: cache
returns object
 else cache requests
object from origin client
origin
server, then returns server
object to client
CNT122 -- Computer Communications and Networks I 27
Remove Watermark Wondershare
PDFelement

More about Web caching


 cache acts as both Why Web caching?
client and server  reduce response time
 typically cache is for client request
installed by ISP  reduce traffic on an
(university, company, institution’s access
residential ISP) link.
 Internet dense with
caches: enables “poor”
content providers to
effectively deliver
content (but so does
P2P file sharing)
CNT122 -- Computer Communications and Networks I 28
Remove Watermark Wondershare
PDFelement

Caching example
Assumptions origin
 average object size = 100,000 servers
bits
public
 avg. request rate from Internet
institution’s browsers to origin
servers = 15/sec
 delay from institutional router
1.5 Mbps
to any origin server and back access link
to router = 2 sec
institutional
Consequences network
10 Mbps LAN
 utilization on LAN = 15%
 utilization on access link = 100%
 total delay = Internet delay +
access delay + LAN delay
= 2 sec + minutes + milliseconds
CNT122 -- Computer Communications and Networks I 29
Remove Watermark Wondershare
PDFelement

Caching example (cont)


origin
possible solution servers
 increase bandwidth of access
public
link to, say, 10 Mbps Internet
consequence
 utilization on LAN = 15%
 utilization on access link = 15% 10 Mbps
 Total delay = Internet delay + access link
access delay + LAN delay institutional
= 2 sec + msecs + msecs network
10 Mbps LAN
 often a costly upgrade

CNT122 -- Computer Communications and Networks I 30


Remove Watermark Wondershare
PDFelement

Caching example (cont)


origin
possible solution: install servers
cache public
 suppose hit rate is 0.4 Internet
consequence
 40% requests will be
satisfied almost immediately
1.5 Mbps
 60% requests satisfied by
access link
origin server
 utilization of access link institutional
reduced to 60%, resulting in network
10 Mbps LAN
negligible delays (say 10
msec)
 total avg delay = Internet
delay + access delay + LAN institutional
delay = .6*(2.01) secs +
.4*milliseconds < 1.4 secs cache

CNT122-- Computer Communications and Networks I 31


Remove Watermark Wondershare
PDFelement

Conditional GET
 Goal: don’t send object if cache server
cache has up-to-date cached HTTP request msg
version If-modified-since:
object
 cache: specify date of <date>
not
cached copy in HTTP request
HTTP response modified
If-modified-since:
HTTP/1.0
<date>
304 Not Modified
 server: response contains no
object if cached copy is up-
to-date: HTTP request msg
If-modified-since:
HTTP/1.0 304 Not <date> object
Modified modified
HTTP response
HTTP/1.0 200 OK
<data>

CNT122 -- Computer Communications and Networks 32


I

You might also like