0% found this document useful (0 votes)
26 views36 pages

WWW and HTTP

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

WWW and HTTP

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

Chapter 27

WWW and HTTP

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

The WWW today is a distributed client/server service,


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

Topics discussed in this section:


Client (Browser)
Server
Uniform Resource Locator
Cookies

27.2
Figure 27.1 Architecture of WWW

27.3
Figure 27.2 Browser

27.4
Figure 27.3 URL

27.5
27--2 WEB DOCUMENTS
27

Th documents
The d t in
i the
th WWW can be b groupedd into
i t three
th
broad categories
categories:: static
static,, dynamic
dynamic,, and active
active.. The
category
t i based
is b d on the th time
ti att which
hi h the
th contents
t t off
the document are determined
determined..

Topics discussed in this section:


Static Documents
Dynamic Documents
Active Documents

27.6
Figure 27.4 Static document

27.7
Figure 27.5 Boldface tags

27.8
Figure 27.6 Effect of boldface tags

27.9
Figure 27.7 Beginning and ending tags

27.10
Figure 27.8 Dynamic document using CGI

27.11
Figure 27.9 Dynamic document using server-site script

27.12
Note

Dynamic documents are sometimes


referred
f d to
t as server-site
it dynamic
d i
documents.

27.13
Figure 27.10 Active document using Java applet

27.14
Figure 27.11 Active document using client-site script

27.15
Note

Active documents are sometimes


referred
f d to
t as client-site
li t it dynamic
d i
documents.

27.16
27--3 HTTP
27

The Hypertext Transfer Protocol (HTTP) is a protocol


used mainly to access data on the World Wide Web.
Web.
HTTP functions as a combination of FTP and SMTP
SMTP..

Topics discussed in this section:


HTTP Transaction
Persistent Versus Nonpersistent Connection

27.17
Note

HTTP uses the services of TCP on well-


k
known portt 80.
80

27.18
Figure 27.12 HTTP transaction

27.19
Figure 27.13 Request and response messages

27.20
Figure 27.14 Request and status lines

27.21
Table 27.1 Methods

27.22
Table 27.2 Status codes

27.23
Table 27.2 Status codes (continued)

27.24
Figure 27.15 Header format

27.25
Table 27.3 General headers

27.26
Table 27.4 Request headers

27.27
Table
b e 27.5
7.5 Response
espo se headers
eade s

27.28
Table 27.6 Entity headers

27.29
Example 27.1

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
h HTTP version i ( ) The
(1.1). h header
h d has h two lines
li that
h
show that the client can accept images in the GIF or
JPEG G format.
f The
h request does
d not have
h a body.
b d The h
response message contains the status line and four lines
off header.
h d The Th header
h d lines
li d fi the
define h date,
d server, MIME
version, and length of the document. The body of the
d
document f ll
follows the
h header
h d (see
( Fi
Figure 27 16)
27.16).

27.30
Figure 27.16 Example 27.1

27.31
Example 27.2

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
f li
lines off headers.
h d The
h request body
b d contains
i the
h
input information. The response message contains the
status line
li andd four
f li
lines off headers.
h d The
h createdd
document, which is a CGI document, is included as the
b d (see
body ( Fi
Figure 27 17)
27.17).

27.32
Figure 27.17 Example 27.2

27.33
Example 27.3

HTTP uses ASCII characters. A client can directly


connect to a server using TELNET, which logs into port
80 (see next slide). The next three lines show that the
connectioni isi successful.
f l We then
h type threeh li
lines. The
h
first shows the request line (GET method), the second is
the
h header
h d (defining
(d fi i the
h host),
h ) the h third
hi d is
i a blank,
bl k
terminating the request. The server response is seven
li
lines starting
i withi h the
h status line.
li Th blank
The bl k line
li at theh
end terminates the server response. The file of 14,230
li
lines i received
is i d after
f the
h blank
bl k line
li (not
( shown
h h )
here).
The last line is the output by the client.

27.34
Example 27.3 (continued)

27.35
Note

HTTP version 1.1 specifies a persistent


connection
ti by
b default.
d f lt

27.36

You might also like