Docsity

Application Protocols HTTP - Computer Networks - Lecture Slides, Slides of Computer Networks

Partial preview of the text

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

2: Application Layer 1

3: Application Protocols:

HTTP

2: Application Layer 2

Top-down: Internet protocol

stack

Application

Transport

Network

Physical

users

network

HTTP, SMTP, FTP, TELNET, DNS, …

TCP, UDP.

IP

Point-to-point links,

LANs, radios, ...

2: Application Layer 4

Applications and application-layer protocols

Application: communicating, distributed processes  running in network hosts in “user space”  exchange messages to implement app  e.g., email, file transfer, the Web Application-layer protocols  one “piece” of an app (web browser do more than speak HTTP)  define messages exchanged by apps and actions taken  user services provided by lower layer protocols

application transport network data link physical

application transport network data link physical

application transport network data link physical

2: Application Layer 5

Client-server paradigm

Typical network app has two

pieces: client andserver

application transport network data link physical

application transport network data link physical

Server:  Running first (always?)  provides requested service to client e.g., Web server sends requested Web page, mail server delivers e-mail Client:  initiates contact with server (usually “speaks” first)  typically requests service from server,  for Web, client is implemented in browser; for e-mail, in mail reader

request

reply

2: Application Layer 7

What is the Internet used for?

Credit: CAIDA (1999)

2: Application Layer 8

HTTP

2: Application Layer 10

http request message: general format

2: Application Layer 11

Methods

 "OPTIONS" ; Section 9.2 |

 "GET" ; Section 9.3 |

 "HEAD" ; Section 9.4 |

 "POST" ; Section 9.5 |

 "PUT" ; Section 9.6 |

 "DELETE" ; Section 9.7 |

 "TRACE" ; Section 9.8 |

 "CONNECT" ; Section 9.9 |

 extension-method extension-method = token

2: Application Layer 13

Request Headers

 Accept ; Section 14.

 Accept-Charset ; Section 14.

 Accept-Encoding ; Section 14.

 Accept-Language ; Section 14.

 Authorization ; Section 14.

 Expect ; Section 14.

 From ; Section 14.

 Host ; Section 14.

 If-Match ; Section 14.

 If-Modified-Since ; Section 14.

 If-None-Match ; Section 14.

 If-Range ; Section 14.

 If-Unmodified-Since ; Section

 Max-Forwards ;

 Section 14.31 |

 Proxy-Authorization ;

 Section 14.34 |

 Range ;

 Section 14.35 |

 Referer ; Misspelled 

 Section 14.36 |

 TE ;

 Section 14.39 |

 User-Agent ;

 Section 14.

Docsity.com

2: Application Layer 14

http message format: response

HTTP/1.0 200 OK

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

2: Application Layer 16

http example

Suppose user enters URL

www.someSchool.edu/someDepartment/home.index

1a. http client initiates TCP connection to http server (process) at www.someSchool.edu. Port 80 is default for http server.

  1. http client sends http request message (containing URL) into TCP connection socket

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 (someDepartment/home.index), sends message into socket

time

(contains text, references to 10 jpeg images)

2: Application Layer 17

http example (cont.)

  1. http client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects

  2. Steps 1-5 repeated for each of 10 jpeg objects 4. http server closes TCP connection.

time

2: Application Layer 19

Stateless vs Stateful

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

2: Application Layer 20

Conditional GET

 Goal: don’t send object if client has up-to-date stored (cached) version

 client: specify date of cached copy in http request If-modified-since:

 server: response contains no object if cached copy up- to-date: HTTP/1.0 304 Not Modified

client server

http request msg If-modified-since: http response HTTP/1. 304 Not Modified

object not modified

http request msg If-modified-since: http response HTTP/1.0 200 OK …

object modified