20
TCP/IP Protocol Suite 1 Chapter 22 Chapter 22 Upon completion you will be able to: World Wide Web: World Wide Web: HTTP HTTP Know how HTTP accesses data on the WWW Objectives

Chapter 22

  • Upload
    melora

  • View
    15

  • Download
    0

Embed Size (px)

DESCRIPTION

Chapter 22. World Wide Web: HTTP. Objectives . Upon completion you will be able to:. Know how HTTP accesses data on the WWW. 22.3 HTTP. - PowerPoint PPT Presentation

Citation preview

Page 1: Chapter   22

TCP/IP Protocol Suite 1

Chapter 22Chapter 22

Upon completion you will be able to:

World Wide Web:World Wide Web:HTTPHTTP

•Know how HTTP accesses data on the WWW

Objectives

Page 2: Chapter   22

TCP/IP Protocol Suite 2

22.3 HTTP

The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data on the World Wide Web. HTTP functions like a combination access data on the World Wide Web. HTTP functions like a combination of FTP and SMTP. of FTP and SMTP.

The topics discussed in this section include:The topics discussed in this section include:

HTTP Transaction HTTP Transaction Persistent versus Nonpersistent Connection Persistent versus Nonpersistent Connection Proxy Server Proxy Server

Page 3: Chapter   22

TCP/IP Protocol Suite 3

Figure 22.12 HTTP transaction

HTTP uses the services of TCP on the well-known port number 80.

Page 4: Chapter   22

TCP/IP Protocol Suite 4

Figure 22.13 Request and response messages

A request message consists of a request line, a header, andsometimes a body. A response message consists of a statusline, a header, and sometimes a body.

Page 5: Chapter   22

TCP/IP Protocol Suite 5

Figure 22.14 Request and status lines

Request type: a particular method (methods are shown on the nextslide)HTTP version: 1.1Status code: similar to those in SMTP (see slides 7 and 8)Status phrase: the text version of the status code (also shown inslides 7 and 8)

Page 6: Chapter   22

TCP/IP Protocol Suite 6

Table 22.1 Table 22.1 MethodsMethods

Page 7: Chapter   22

TCP/IP Protocol Suite 7

Table 22.2 Table 22.2 Status codesStatus codes

Page 8: Chapter   22

TCP/IP Protocol Suite 8

Table 22.2 Table 22.2 Status codes (continued)Status codes (continued)

Page 9: Chapter   22

TCP/IP Protocol Suite 9

Figure 22.15 Header format

The header exchanges additional info between the clientand the server.

The header can consist of one or more header lines.

Each header line looks like this:

There are four categories of header lines: general header,request header, response header, and entity header.

Page 10: Chapter   22

TCP/IP Protocol Suite 10

Table 22.3 Table 22.3 General headersGeneral headers

Gives general information about the message and can be presentin both a request and a response.

Page 11: Chapter   22

TCP/IP Protocol Suite 11

Table 22.4 Table 22.4 Request headersRequest headers

Only present in a request message; specifies the client’sconfiguration and preferred document format.

Page 12: Chapter   22

TCP/IP Protocol Suite 12

Table 22.5 Table 22.5 Response headersResponse headers

Page 13: Chapter   22

TCP/IP Protocol Suite 13

Table 22.6 Table 22.6 Entity headersEntity headers

Gives info about the body of the document; mostly present in responsemessages, but also present in some request messages such as POST orPUT methods that contain a body.

Page 14: Chapter   22

TCP/IP Protocol Suite 14

This example retrieves a document. We use the GET method to retrieve an image with the path /usr/bin/image1. The request line shows the method (GET), the URL, and the HTTP version (1.1). The header has two lines that show that the client can accept images in the GIF or JPEG format. The request does not have a body. The response message contains the status lineand four lines of header. The header lines define the date, server, MIME version, and length of the document. The body of the document follows the header (see Figure 22.16).

Example 1

See Next Slide

Page 15: Chapter   22

TCP/IP Protocol Suite 15

Figure 22.16 Example 1

Page 16: Chapter   22

TCP/IP Protocol Suite 16

In this example, the client wants to send data to the server. We use the POST method. The request line shows the method (POST), URL, and HTTP version (1.1). There are four lines of headers. The request body contains the input information. The response message contains the status line and four lines of headers. The created document, which is a CGI document, is included as the body (see Figure 22.17).

Example 2

See Next Slide

Page 17: Chapter   22

TCP/IP Protocol Suite 17

Figure 22.17 Example 2

Page 18: Chapter   22

TCP/IP Protocol Suite 18

Example 3

Here is the first request in a notification server session:

POST http://gateway.messenger.hotmail.com/gateway/gateway.dll?Action=open&Server=

NS&IP=messenger.hotmail.com HTTP/1.1Accept: */*Accept-Language: en-usAccept-Encoding: gzip, deflateUser-Agent: MSMSGSHost: gateway.messenger.hotmail.comProxy-Connection: Keep-AliveConnection: Keep-AlivePragma: no-cacheContent-Type: application/x-msn-messengerContent-Length: 18

VER 5 MSNP8 CVR0

Page 19: Chapter   22

TCP/IP Protocol Suite 19

Example 3

Here is the response:

HTTP/1.0 200 OKServer: Microsoft-IIS/5.0Date: Tue, 18 Mar 2003 07:39:53 GMTX-MSN-Messenger: SessionID=954547325.13160; GW-IP=207.46.110.18Content-Length: 18Content-Type: application/x-msn-messengerAge: 0Via: HTTP/1.1 ntl_site (Traffic-Server/5.2.0-R [c sSf ])X-Cache: MISS from nautilus.localdomainX-Cache-Lookup: MISS from nautilus.localdomain:80Proxy-Connection: keep-alive

VER 5 MSNP8 CVR0

Page 20: Chapter   22

TCP/IP Protocol Suite 20

HTTP version 1.1 specifies a persistent connection by default.

In other words, the server leaves the connection open for more requests

after sending a response.

HTTP v1 opened a separate TCP connection for each part (image) of

the web page. Very wasteful.