1 computer communication & networks lecture 28 application layer: http & www p waleed ejaz...

17
1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW http://web.uettaxila.edu.pk/CMS/coeCCNbsSp0 9/index.asp Waleed Ejaz [email protected]

Upload: milton-hart

Post on 28-Dec-2015

215 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

1

Computer Communication & Networks

Lecture 28

Application Layer: HTTP & WWW

http://web.uettaxila.edu.pk/CMS/coeCCNbsSp09/index.asp

Waleed [email protected]

Page 2: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

2

Application Layer

Page 3: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

3

Application Layer Topics to Cover

DNSElectronic Mail

File Transfer

HTTP, WWW

Page 4: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

4

Web and HTTP

Page 5: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

5

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

Page 6: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

6

Uniform Resource Locator

Page 7: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

7

HTTP overviewHTTP: hypertext transfer protocol

• Web’s application layer protocol

• client/server modelo client: browser that

requests, receives, “displays” Web objects

o server: Web server sends objects in response to requests

• HTTP 1.0: RFC 1945• HTTP 1.1: RFC 2068

PC runningExplorer

Server running

Apache Webserver

Mac running

Navigator

HTTP request

HTTP request

HTTP response

HTTP response

Page 8: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

8

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

HTTP is “stateless”• server maintains no

information about past client requests

Protocols that maintain “state” are complex!• past history (state) must

be maintained• if server/client crashes,

their views of “state” may be inconsistent, must be reconciled

aside

Page 9: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

9

HTTP connections

Nonpersistent HTTP• At most one object is

sent over a TCP connection.

• HTTP/1.0 uses nonpersistent HTTP

Persistent HTTP• Multiple objects can be

sent over single TCP connection between client and server.

• HTTP/1.1 uses persistent connections in default mode

Page 10: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

10

Nonpersistent HTTPSuppose user enters URL

www.someSchool.edu/someDepartment/home.index1a. HTTP client initiates TCP

connection to HTTP server (process) at www.someSchool.edu on port 80

2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index

1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client

3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket

time

(contains text, references to 10

jpeg images)

Page 11: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

11

Nonpersistent HTTP (cont.)

5. HTTP client receives response message containing html file,

displays html. Parsing html file, finds 10 referenced

jpeg objects

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

4. HTTP server closes TCP connection.

time

Page 12: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

12

Response time modelingDefinition of RTT: time for a small packet to travel from client to server and back.

Response time:• one RTT to initiate TCP

connection• one RTT for HTTP

request and first few bytes of HTTP response to return

• file transmission timetotal = 2RTT+transmit time

time to transmit file

initiate TCPconnection

RTT

requestfile

RTT

filereceived

time time

Page 13: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

13

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

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

Page 14: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

14

Web caches (proxy server)

• user sets browser: Web accesses via cache

• browser sends all HTTP requests to cacheo object in cache: cache

returns object o else cache requests

object from origin server, then returns object to client

Goal: satisfy client request without involving origin server

client

Proxyserver

client

HTTP request

HTTP request

HTTP response

HTTP response

HTTP request

HTTP response

origin server

origin server

Page 15: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

15

More about Web caching

• Cache acts as both client and server

• Typically cache is installed by ISP (university, company, residential ISP)

Why Web caching?• 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 (but so does P2P file sharing)

Page 16: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

16

Page 17: 1 Computer Communication & Networks Lecture 28 Application Layer: HTTP & WWW  p Waleed Ejaz waleed.ejaz@uettaxila.edu.pk

17

Quiz Retake• What are the key differences between FTP and HTTP? [2]• Consider an HTTP client that wants to retrieve a Web document at a

given URL. The IP address of the HTTP server is initially unknown. The Web document at the URL has one embedded GIF image that resides at the same server as the original document. What transport and application layer protocols besides HTTP are needed in this scenario? [3]

• Suppose within your Web browser you click on a link to obtain a Web page. The IP address for the associated URL is not cached in your local host, so a DNS look-up is necessary to obtain the IP address. Suppose that n DNS servers are visited before your host receives the IP address from DNS; the successive visits incur an RTT of RTT1, … RTTn. Further suppose that the Web page is an HTML text file and four additional objects. Let RTT0 denote a RTT between the local host and the server containing the object. Assuming zero transmission time of the object, how much time elapses from when the client clicks on the link until the client receives the entire Web page? Assume a non-persistent HTTP protocol with no parallel TCP connections. [4]