Download - Chapter 27
![Page 1: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/1.jpg)
27.1
Chapter 27
WWW and HTTP
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
![Page 2: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/2.jpg)
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: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/3.jpg)
27.3
Figure 27.1 Architecture of WWW
![Page 4: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/4.jpg)
27.4
Figure 27.2 Browser
![Page 5: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/5.jpg)
27.5
Figure 27.3 URL
![Page 6: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/6.jpg)
27.6
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 7: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/7.jpg)
27.7
Figure 27.4 Static document
![Page 8: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/8.jpg)
27.8
Figure 27.5 Boldface tags
![Page 9: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/9.jpg)
27.9
Figure 27.6 Effect of boldface tags
![Page 10: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/10.jpg)
27.10
Figure 27.7 Beginning and ending tags
![Page 11: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/11.jpg)
27.11
Figure 27.8 Dynamic document using CGI
![Page 12: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/12.jpg)
27.12
Figure 27.9 Dynamic document using server-site script
![Page 13: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/13.jpg)
27.13
Dynamic documents are sometimes referred to as server-site dynamic
documents.
Note
![Page 14: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/14.jpg)
27.14
Figure 27.10 Active document using Java applet
![Page 15: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/15.jpg)
27.15
Figure 27.11 Active document using client-site script
![Page 16: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/16.jpg)
27.16
Active documents are sometimes referred to as client-site dynamic
documents.
Note
![Page 17: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/17.jpg)
27.17
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 functions as a combination of FTP and SMTP. HTTP functions as a combination of FTP and SMTP.
HTTP TransactionPersistent Versus Nonpersistent Connection
Topics discussed in this section:Topics discussed in this section:
![Page 18: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/18.jpg)
27.18
HTTP uses the services of TCP on well-known port 80.
Note
![Page 19: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/19.jpg)
27.19
Figure 27.12 HTTP transaction
![Page 20: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/20.jpg)
27.20
Figure 27.13 Request and response messages
![Page 21: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/21.jpg)
27.21
Figure 27.14 Request and status lines
![Page 22: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/22.jpg)
27.22
Table 27.1 Methods
![Page 23: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/23.jpg)
27.23
Table 27.2 Status codes
![Page 24: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/24.jpg)
27.24
Table 27.2 Status codes (continued)
![Page 25: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/25.jpg)
27.25
Figure 27.15 Header format
![Page 26: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/26.jpg)
27.26
Table 27.3 General headers
![Page 27: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/27.jpg)
27.27
Table 27.4 Request headers
![Page 28: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/28.jpg)
27.28
Table 27.5 Response headers
![Page 29: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/29.jpg)
27.29
Table 27.6 Entity headers
![Page 30: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/30.jpg)
27.30
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 line and 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 27.16).
Example 27.1
![Page 31: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/31.jpg)
27.31
Figure 27.16 Example 27.1
![Page 32: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/32.jpg)
27.32
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 27.17).
Example 27.2
![Page 33: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/33.jpg)
27.33
Figure 27.17 Example 27.2
![Page 34: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/34.jpg)
27.34
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 connection is successful. We then type three lines. The first shows the request line (GET method), the second is the header (defining the host), the third is a blank, terminating the request. The server response is seven lines starting with the status line. The blank line at the end terminates the server response. The file of 14,230 lines is received after the blank line (not shown here). The last line is the output by the client.
Example 27.3
![Page 35: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/35.jpg)
27.35
Example 27.3 (continued)
![Page 36: Chapter 27](https://reader035.vdocuments.us/reader035/viewer/2022062513/555ae4aed8b42a62528b54b4/html5/thumbnails/36.jpg)
27.36
HTTP version 1.1 specifies a persistent connection by default.
Note