Top Banner
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
36

27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Dec 27, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.1

Chapter 27

WWW and HTTP

Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Page 2: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.2

27-1 ARCHITECTURE27-1 ARCHITECTURE

The The WWWWWW today is a distributed client/server service, today is a distributed client/server service, in which a client using a browser can access a service in which a client using a browser can access a service using a server. However, the service provided is using a server. However, the service provided is distributed over many locations called sites.distributed over many locations called sites.

Client (Browser)ServerUniform Resource LocatorCookies

Topics discussed in this section:Topics discussed in this section:

Page 3: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.3

Figure 27.1 Architecture of WWW

Page 4: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.4

Figure 27.2 Browser

Page 5: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.5

Figure 27.3 URL

http://https://ftp://

80 by default

Page 6: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

The WWW was originally designed as a stateless entity.

Cookies are needed for extending functionalities of the Web, such as: To remember past client in order to show a

customized webpage.

27.6

Cookies

Page 7: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

When a server receives a request from a client, it stores information about the client in a file or a string.

The server includes the cookie in the response that it sends to the client.

When the client receives the response, the browser stores the cookie in the cookie directory.

27.7

Cookies: Creation and storage

Page 8: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.8

27-2 WEB DOCUMENTS27-2 WEB DOCUMENTS

The documents in the WWW can be grouped into three The documents in the WWW can be grouped into three broad categories: broad categories: staticstatic, , dynamicdynamic, and , and activeactive. The . The category is based on the time at which the contents of category is based on the time at which the contents of the document are determined.the document are determined.

Static DocumentsDynamic DocumentsActive Documents

Topics discussed in this section:Topics discussed in this section:

Page 9: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.9

Figure 27.4 Static document

Uses the Hypertext Markup Language (HTML)

Page 10: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.10

Figure 27.5 Boldface tags

Page 11: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.11

Figure 27.7 Beginning and ending tags

Example: <a href="Chapter3-part3.ppt">Chapter3-

part3</a> <img src="../images/smallUCF.gif" width="200"

border="0" height="76">

Page 12: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.12

Figure 27.8 Dynamic document using CGI

Page 13: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.13

Figure 27.9 Dynamic document using server-site script

Page 14: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.14

Dynamic documents are sometimes referred to as server-site dynamic

documents.

Note

Page 15: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.15

Figure 27.10 Active document using Java applet

Page 16: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.16

Figure 27.11 Active document using client-site script

Page 17: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.17

Active documents are sometimes referred to as client-site dynamic

documents.

Note

Page 18: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.18

27-3 HTTP27-3 HTTP

The Hypertext Transfer Protocol (HTTP) is a protocol The Hypertext Transfer Protocol (HTTP) is a protocol used mainly to access data on the World Wide Web. used mainly to access data on the World Wide Web.

HTTP TransactionPersistent Versus Nonpersistent Connection

Topics discussed in this section:Topics discussed in this section:

Page 19: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.19

Figure 27.12 HTTP transaction

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

Page 20: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.20

Figure 27.13 Request and response messages (all in Plain Text)

Page 21: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.21

Table 27.1 Methods

Page 22: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.22

Table 27.2 Status codes

Page 23: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.23

Table 27.2 Status codes (continued)

Page 24: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.24

Figure 27.15 Header format

Page 25: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.25

Table 27.3 General headers

Page 26: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.26

Table 27.4 Request headers

Page 27: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.27

Table 27.5 Response headers

Page 28: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.28

Table 27.6 Entity headers

Page 29: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.29

Figure 27.16 Example 27.1

Page 30: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.30

Figure 27.17 Example 27.2 (client sends data to server)

Page 31: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.31

Example 27.3 (continued)

Page 32: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Trying out HTTP (client side) for yourself

1. Telnet to your favorite Web server:

Opens TCP connection to port 80(default HTTP server port) at cs.ucf.edu.Anything typed in sent to port 80 at www.cs.ucf.edu

telnet www.cs.ucf.edu 80

2. Type in a GET HTTP request:GET /~czou/CNT3004/example.html HTTP/1.1Host: www.cs.ucf.edu

By typing this in (hit carriagereturn twice), you sendthis minimal (but complete) GET request to HTTP server

3. Look at response message sent by HTTP server!

27.32

Page 33: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Web Browser’s Operation

First, get the basis static HTML file /~czou/CNT3004/example.html

Second, interpret HTML to find all contained “objects” Images, java applets, flash,….

<img src="../images/smallUCF.gif“ > <img

src=“http://upload.wikimedia.org/wikipedia/commons/6/63/Wikipedia-logo.png” >

Third, get those objects via HTTP

27.33

Page 34: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Let’s look at HTTP in action

Telnet example “GET” must be Capital letters! Must have “host” header!

For web proxy reason A proxy can know where to forward the GET

request

What if type in “HTTP/1.0” ? Wireshark example

27.34

Page 35: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

27.35

HTTP version 1.1 specifies a persistent connection by default.

Note

Page 36: 27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Persistent vs Nonpersistent Connection In a nonpersistent connection, one

TCP connection is made for each request/response.

In a persistent connection, the server leaves the connection open for more requests after sending a response.

The server can close the connection at the request of a client or if a time-out has been reached.

27.36 Wireshark example