69
http.1 WWW-HTTP

 · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.1

WWW-HTTP

Page 2:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.2

Internet Status

Page 3:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.3

http:1 ARCHITECTUREhttp:1 ARCHITECTURE

TheThe WWWWWW todaytoday isis aa distributeddistributed client/serverclient/server service,service,inin whichwhich aa clientclient usingusing aa browserbrowser cancan accessaccess aa serviceserviceusingusing aa serverserver.. However,However, thethe serviceservice providedprovided isisdistributeddistributed overover manymany locationslocations calledcalled sitessites..

Page 4:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of

a hypertext-based information

1990 Berners-Lee, & Robert Cailliau, created the first Webbrowsers and servers. Called World Wide Web and later renamedNexus.

Browsers needed a protocol to regulate their communications; Berners-Lee and Cailliau designed the first version of http.

http.4

Page 5:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

HTTP Architecture

5

Page 6:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

HTTP

6

Page 7:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.7

Figure http.1 Architecture of WWW

Page 8:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.8

URL

Page 9:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.9

Uniform Resource Identifiers

Page 10:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Browser Communication

http.10

Page 11:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.11

Figure http.2 Browser

Page 12:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.12

httphttp--2 WEB DOCUMENTS2 WEB DOCUMENTS

TheThe documentsdocuments inin thethe WWWWWW cancan bebe groupedgrouped intointo threethreebroadbroad categoriescategories:: staticstatic,, dynamicdynamic,, andand activeactive.. TheThecategorycategory isis basedbased onon thethe timetime atat whichwhich thethe contentscontents ofofthethe documentdocument areare determineddetermined..

Page 13:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.13

Figure http.4 Static document

Page 14:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.14

Figure http.5 Boldface tags

Page 15:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.15

Figure http.6 Effect of boldface tags

Page 16:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.16

Figure http.7 Beginning and ending tags

Page 17:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.17

Figure http.8 Dynamic document using CGI

Page 18:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.18

Figure http.9 Dynamic document using server-site script

Page 19:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.19

Dynamic documents are sometimes referred to as server-site dynamic

documents.

Page 20:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.20

Figure http.10 Active document using Java applet

Page 21:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.21

Figure http.11 Active document using client-site script

Page 22:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.22

Active documents are sometimes referred to as client-site dynamic

documents.

Note

Page 23:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.23

httphttp--3 HTTP3 HTTP

TheThe HypertextHypertext TransferTransfer ProtocolProtocol (HTTP)(HTTP) isis aa protocolprotocolusedused mainlymainly toto accessaccess datadata onon thethe WorldWorld WideWide WebWeb..HTTPHTTP functionsfunctions asas aa combinationcombination ofof FTPFTP andand SMTPSMTP..

Page 24:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.24

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

Note

Page 25:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.25

Figure http.12 HTTP transaction

Page 26:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.26

Figure http.13 Request and response messages

Page 27:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.27

Figure http.14 Request and status lines

Page 28:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.28

Table http.1 Methods

Page 29:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.29

Table http.2 Status codes

Page 30:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.30

Table http.2 Status codes (continued)

Page 31:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.31

Figure http.15 Header format

Page 32:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

HTTP1.0 Non-persistence

[email protected]

Page 33:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

HTTP1.1 Persistence

[email protected]

Page 34:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Pipelining

Client does not have to wait for a response to one request before issuing a new request on the connection. It can follow the first request immediately with a second request.

[email protected] 34

Page 35:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Impact of Persistence and Pipelining

[email protected] 35

Page 36:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

User Operations

Web Page Retrieval – GET A server responds to a GET request by

returning the requested resource, often a new Web page. The new page is the data in the response.

[email protected] 36

Page 37:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

User Operations

Web Forms – POST A server responds to a POST request by returning

new information such as search results. Thisinformation is carried as data in the response.

[email protected] 37

Page 38:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

User Operations

File Upload – PUT Clients can use the PUT request to send a new

object to a server. The URI that’s part of the request tells the server where to put the object.

[email protected] 38

Page 39:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

User Operations File Deletion – DELETE

Client sends a DELETE message along with the uri of theobject the server should remove. The server responds witha status code and, optionally, more data for the client.

[email protected] 39

Page 40:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

User Operations Capabilities – OPTIONS

Clients can use an OPTIONS message to discover whatcapabilities a server supports. If the client includes a uri, theserver responds with the options relevant to that object.

If the client sends an asterisk (*) as the uri, the server returnsthe general options that apply to all objects it maintains.

A client might use it to determine the http version or, encoding methods (in the case of a specific uri).

[email protected] 40

Page 41:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

User Operations Status – HEAD

The HEAD request mimics a GET operation, except that the server does not actually return the requested object, only HTTP headers.

[email protected] 41

Page 42:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

User Operations Path – TRACE

The TRACE message gives clients a way to check the network path to aserver.

When a server receives a TRACE, it responds simply by copying theTRACE message itself into the data for the response.

[email protected] 42

Page 43:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

100 Information

Clients can ask a server to accept a request before they send the entiremessage body.

The Expect header asks the server to signal its acceptance by returning a100 status. Once the client receives a 100 status, it continues by sending therest of the request.

http.43

Page 44:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

101 Switching Protocol Information

Servers use the 101 Switching Protocols response to accept aclient’s request to upgrade protocols.

The 101 status indicates that the sender is going to changeprotocols. The client should be using the new protocol as soon as itreceives the 101 response.

http.44

Page 45:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Virtual Hosts

The designers of version 1.0 did not anticipate—Web hosting providers.

1.1 adds Virtual host support

[email protected] 45

Page 46:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Redirection

Redirection offers a way to support a single site to usemultiple servers. Redirection lets a server redirect aclient to another uri for an object.

http.46

Page 47:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Proxies

The server that the client first contacts relays the request toa new server and then relays the second server’s responseback to the client.

Enforcing policy for an organization to filter that Internetaccess

http.47

Page 48:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Proxy Chain As each server adds its own identity to the Via header in the request,

which captures the path taken by the request through the server chain.The response follows the same process, with each proxy inserting itsidentity in the Via header.

Proxy servers perform several important functions for httpcommunications. The most common is in support of caching

http.48

Page 49:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Gateways Gateways act as an endpoint to a server chain, but they

still rely on other servers to provide all or part of therequested object.

Gateways may use a protocol other than http to accessthe object.

http.49

Page 50:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Tunnels

A tunnel allows a client to communicate directly with a distantserver. Tunnel creates a secure path for the client’s request and theserver’s response.

Tunnels are relatively transparent to the original client

http.50

Page 51:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Cache Servers

Cache servers are proxy servers that relay requests and responses. In addition, they keep a local copy of any responses they receive.

http.51

Page 52:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Advantages

Reduces the load on origin servers Improves Performance

Disadvantages Cache deliver pages remains transparent to

origin server Site derives revenue from advertising

http.52

Page 53:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Counting and Limiting Page Views Proxies that support metering insert the Meter header in requests

passing through them. Servers ask for metering on a particular objectby including the Meter header in their replies.

By inserting it a client indicates its willingness to report on and limit thenumber of times it returns the resulting response from its cache.

For new client’s request for same object, the proxies validate it with the origin server & update the Meter header in their requests.

Proxy issues a HEAD request to make sure its cachedcopy is still valid.

http.53

Page 54:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Cookies and State Maintenance

http normally operates as if each client request is independent of all others.

Stateless Because maintaining state requires server resources (memory,

processing power, etc.)

State full is also required

http.54

Page 55:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

Cookies State maintenance requires one critical capability The mechanism that http defines for state maintenance is

known as a cookie. A server creates cookies to track the state of a client, and it

returns it to the client in its response. Once the clientreceives a cookie, it can include the cookie in subsequentrequests to the same server

http.55

Page 56:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.56

Date

The Date header indicates the time that the system sending a message originallygenerated that message.

The Last-Modified header provides the time of the resource.

Page 57:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.57

ETag

Identify resources

Origin servers can assign an Etag

Strong Etag and

Weak Etag

Page 58:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.58

Table http.3 General headers

Page 59:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.59

Table http.4 Request headers

Page 60:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.60

Table http.5 Response headers

Page 61:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.61

Table http.6 Entity headers

Page 62:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.62

This example retrieves a document. We use the GETmethod to retrieve an image with the path /usr/bin/image1.The request line shows the method (GET), the URL, andthe HTTP version (1.1). The header has two lines thatshow that the client can accept images in the GIF orJPEG format. The request does not have a body. Theresponse message contains the status line and four linesof header. The header lines define the date, server, MIMEversion, and length of the document. The body of thedocument follows the header (see Figure http.16).

Example http.1

Page 63:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.63

Figure http.16 Example http.1

Page 64:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.64

In this example, the client wants to send data to theserver. We use the POST method. The request line showsthe method (POST), URL, and HTTP version (1.1). Thereare four lines of headers. The request body contains theinput information. The response message contains thestatus line and four lines of headers. The createddocument, which is a CGI document, is included as thebody .

Example http.2

Page 65:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.65

Figure http.17 Example http.2

Page 66:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.66

HTTP uses ASCII characters. A client can directlyconnect to a server using TELNET, which logs into port80. We then type three lines. The first shows the requestline (GET method), the second is the header (defining thehost), the third is a blank, terminating the request. Theserver 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 http.3

Page 67:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.67

Example http.3 (continued)

Page 68:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.68

HTTP version 1.1 specifies a persistent connection by default.

Note

Request Headers

Page 69:  · WWW and HTTP March 1989 that Tim Berners-Lee first outlined the advantages of a hypertext-based information 1990 Berners-Lee, & Robert Cailliau, created the first Web browsers

http.69

Response Headers