0% found this document useful (0 votes)
17 views19 pages

HTTP Message

The document discusses HTTP and web applications. It describes how HTTP works using a client-server model and how objects are requested from servers. It also explains features like persistent connections, pipelining, different HTTP methods and request/response message formats.

Uploaded by

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

HTTP Message

The document discusses HTTP and web applications. It describes how HTTP works using a client-server model and how objects are requested from servers. It also explains features like persistent connections, pipelining, different HTTP methods and request/response message formats.

Uploaded by

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

Chapter 2

Application Layer

A note on the use of these ppt slides:


We’re making these slides freely available to all (faculty, students, readers). Computer Networking:
They’re in PowerPoint form so you can add, modify, and delete slides
(including this one) and slide content to suit your needs. They obviously
A Top Down Approach
represent a lot of work on our part. In return for use, we only ask the Featuring the Internet,
following:
 If you use these slides (e.g., in a class) in substantially unaltered form,
that you mention their source (after all, we’d like people to use our book!) 3rd edition.
Jim Kurose, Keith Ross
 If you post any slides in substantially unaltered form on a www site, that
you note that they are adapted from (or perhaps identical to) our slides, and
note our copyright of this material. Addison-Wesley, July
Thanks and enjoy! JFK/KWR 2004.
All material copyright 1996-2006
J.F Kurose and K.W. Ross, All Rights Reserved
2: Application Layer 1
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

2: Application Layer 2
HTTP overview

HTTP: hypertext
transfer protocol HT
TP
req
 Web’s application layer PC running HT ues
TP t
protocol Explorer re sp
ons
 client/server model e

 client: browser that


st
que
requests, receives, Pr
e
n se Server
T o
“displays” Web objects HT r es
p running
TP Apache Web
 server: Web server HT
server
sends objects in
response to requests
Mac running
 HTTP 1.0: RFC 1945 Navigator
 HTTP 1.1: RFC 2068

2: Application Layer 3
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

2: Application Layer 4
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
 HTTP/1.0 uses between client and
nonpersistent HTTP server.
 HTTP/1.1 uses
persistent connections
in default mode

2: Application Layer 5
Nonpersistent HTTP
(contains text,
Suppose user enters URL www.someSchool.edu/someDepartment/home.index
references to 10
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
2: Application Layer 6
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

2: Application Layer 7
Non-Persistent HTTP: Response time
Definition of RTT: time to
send a small packet to
travel from client to
server and back. initiate TCP
Response time: connection
RTT
 one RTT to initiate TCP
request
connection file
time to
 one RTT for HTTP request RTT
transmit
and first few bytes of file
file
HTTP response to return received
 file transmission time
time
total = 2RTT+transmit time time

2: Application Layer 8
Persistent HTTP

Nonpersistent HTTP issues: Persistent without pipelining:


 requires 2 RTTs per object  client issues new request
 OS overhead for each TCP only when previous
connection response has been received
 browsers often open parallel  one RTT for each

TCP connections to fetch referenced object


referenced objects Persistent with pipelining:
Persistent HTTP  default in HTTP/1.1
 server leaves connection  client sends requests as
open after sending response soon as it encounters a
 subsequent HTTP messages referenced object
between same client/server  as little as one RTT for all
sent over open connection the referenced objects

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

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

Carriage return,
line feed (extra carriage return, line feed)
indicates end
of message
2: Application Layer 10
HTTP request message: general format

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

www.somesite.com/animalsearch?monkeys&banana

2: Application Layer 12
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

2: Application Layer 13
Method Types
 The first line of an HTTP request message is called the
request line; the subsequent lines are called the header
lines. The request line has three fields: the method field,
the URL field, and the HTTP version field.
 The method field can take on several different values,
including GET, POST, HEAD, PUT, and DELETE.
 The great majority of HTTP request messages use the
GET method. The GET method is used when the browser
requests an object, with the requested object identified in
the URL field.

2: Application Layer 14
GET vs POST Method
 The entity body is empty with the GET method, but is used
with the POST method.
 An HTTP client often uses the POST method when the
user fills out a form—for example, when a user provides
search words to a search engine.
 With a POST message, the user is still requesting a Web
page from the server, but the specific contents of the Web
page depend on what the user entered into the form fields.
 If the value of the method field is POST, then the entity
body contains what the user entered into the form fields.

2: Application Layer 15
HEAD, PUT, and DELETE
 The HEAD method is similar to the GET method. When a
server receives a request with the HEAD method, it
responds with an HTTP message but it leaves out the
requested object. Application developers often use the
HEAD method for debugging.
 The PUT method is often used in conjunction with Web
publishing tools. It allows a user to upload an object to a
specific path (directory) on a specific Web server.
 The PUT method is also used by applications that need to
upload objects to Web servers.
 The DELETE method allows a user, or an application, to
delete an object on a Web server.
2: Application Layer 16
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
header Server: Apache/1.3.0 (Unix)
lines Last-Modified: Mon, 22 Jun 1998 …...
Content-Length: 6821
Content-Type: text/html

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


requested
HTML file

2: Application Layer 17
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
2: Application Layer 18
Thank You

2: Application Layer 19

You might also like