Docsity

Application Layer HTTP-Computer Networking-Lecture Slides, Slides of Computer Networks

Partial preview of the text

Download Application Layer HTTP-Computer Networking-Lecture Slides and more Slides Computer Networks in PDF only on Docsity!

HTTP

Computer Networks

Lecture-

APPLICATION LAYER - HTTP

2: Application Layer 4

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

Docsity.com

2: Application Layer 5

HTTP OVERVIEW

HTTP: hypertext transfer

protocol

»Web’s application layer protocol

»client/server model

» client: browser that requests, receives, “displays” Web objects » server: Web server sends objects in response to requests

»HTTP 1.0: RFC 1945

»HTTP 1.1: RFC 2068

PC running Explorer

Server running Apache Web server

Mac running Navigator

2: Application Layer 7

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

2: Application Layer 8

NONPERSISTENT HTTP

Suppose user enters URL www.someSchool.edu/someDepartment/home.index (contains text, references to 10 jpeg images) 1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80

  1. 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

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

time

2: Application Layer 10

RESPONSE TIME MODELING

Definition of RRT: time to send

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 time

total = 2RTT+transmit time

time to transmit file

initiate TCP connection RTT request file RTT

File received

time time

2: Application Layer 11

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. »client sends requests as soon as it encounters a referenced object »as little as one RTT for all the referenced objects

2: Application Layer 13

HTTP REQUEST MESSAGE: GENERAL FORMAT

2: Application Layer 14

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

2: Application Layer 16

HTTP RESPONSE MESSAGE

HTTP/1.1 200 OK

Connection close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html

data data data data data ...

status line (protocol status code status phrase)

header lines

data, e.g., requested HTML file

Docsity.com

2: Application Layer 17

HTTP RESPONSE STATUS 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

In first line in server->client response message. A few sample codes:

2: Application Layer 19

USER-SERVER STATE: COOKIES

Many major Web sites use

cookies

Four components:

  1. cookie header line in the HTTP response message
  2. cookie header line in HTTP request message
  3. cookie file kept on user’s host and managed by user’s browser
  4. back-end database at Web site

Example: » Susan access Internet always from same PC » She visits a specific e- commerce site for first time » When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID

2: Application Layer 20

COOKIES: KEEPING “STATE” (CONT.)

client (^) server

usual http request msg usual http response + Set-cookie: 1678

usual http request msg cookie: 1678 usual http response msg

usual http request msg cookie: 1678 usual http response msg

cookie- specific action

cookie- spectific action

server creates ID 1678 for user

Cookie file amazon: 1678 ebay: 8734

Cookie file

ebay: 8734

Cookie file amazon: 1678 ebay: 8734

one week later: