15 213 The course that gives CMU its Zip Web services Nov 28 2000 Topics HTTP Serving static content Serving dynamic content class26 ppt Web history 1945 Vannevar Bush As we may think Atlantic Monthly July 1945 Describes the idea of a distributed hypertext system a memex that mimics the web of trails in our minds 1989 Tim Berners Lee CERN writes internal proposal to develop a distributed hypertext system connects a web of notes with links intended to help CERN physicists in large projects share and manage information 1990 Tim BL writes a graphical browser for Next machines class26 ppt 2 CS 213 F 00 Web history cont 1992 NCSA server released 26 WWW servers worldwide 1993 Marc Andreessen releases first version of NCSA Mosaic browser Mosaic version released for Windows Mac Unix Web port 80 traffic at 1 of NSFNET backbone traffic Over 200 WWW servers worldwide 1994 Andreessen and colleagues leave NCSA to form Mosaic Communications Corp now Netscape class26 ppt 3 CS 213 F 00 100 000 000 Internet Domain Survey www isc org Internet hosts 10 000 000 1 000 000 100 000 Mosaic and Netscape 10 000 1 000 100 class26 ppt 4 CS 213 F 00 Web servers Clients and servers communicate using the HyperText Transfer Protocol HTTP client and server establish TCP connection Client requests content Server responds with requested content client and server close connection usually web client browser HTTP request web server HTTP response content Current version is HTTP 1 1 RFC 2616 June 1999 class26 ppt 5 CS 213 F 00 Web server statistics Apache Mosaic Microsoft Other Netscape class26 ppt source Netcraft Web Survey www netcraft com survey 6 CS 213 F 00 Static and dynamic content The content returned in HTTP responses can be either static or dynamic Static content content stored in files and retrieved in response to an HTTP request HTML files images audio clips Dynamic content content produced on the fly in response to an HTTP request Example content produced by a CGI process executed by the server on behalf of the client class26 ppt 7 CS 213 F 00 URIs and URLs network resources are identified by Universal Resource Indicators URIs The most familiar is the absolute URI known as the HTTP URL http url http host port abs path port defaults to 80 abs path defaults to abs path ending in defaults to index html Examples all equivalent http www cs cmu edu 80 index html http www cs cmu edu index html http www cs cmu edu class26 ppt 8 CS 213 F 00 HTTP 1 1 messages An HTTP message is either a Request or a Response HTTP message Request Response Requests and responses have the same basic form generic message start line message header CRLF message body start line message header message body class26 ppt Request line Status line field name field value CRLF e g HTML file 9 CS 213 F 00 HTTP 1 1 requests Request Method SP Request URI SP HTTP VERSION CRLF general header request header entity header CRLF message body Method tells the server what operation to perform e g GET serve static or dynamic content POST serve dynamic content OPTIONS retrieve server and access capabilities Request URI identifies the resource to manipulate data file HTML executable file CGI headers parameterize the method Accept Language en us User Agent Mozilla 4 0 compatible MSIE 4 01 Windows 98 message body text characters class26 ppt 10 CS 213 F 00 HTTP 1 1 responses Response HTTP Version SP Status Code SP Reason Phrase CRLF general header response header entity header CRLF message body Status code 3 digit number Reason Phrase explanation of status code headers parameterize the response Date Thu 22 Jul 1999 23 42 18 GMT Server Apache 1 2 5 BSDI3 0 PHP FI 2 0 Content Type text html message body file class26 ppt 11 CS 213 F 00 How servers interpret Request URIs GET HTTP 1 1 resolves to home html index html action retrieves index html home GET index html HTTP 1 1 resolves to home html index html action retrieves index html cgi bin GET foo html HTTP 1 1 resolves to home html foo html action retrieves foo html GET cgi bin test pl HTTP 1 1 test pl html index html foo html resolves to home cgi bin test pl action runs test pl GET http euro ecom cmu edu index html HTTP 1 1 resolves to home html index html action retrieves index html class26 ppt 12 CS 213 F 00 Example HTTP 1 1 conversation kittyhawk telnet euro ecom cmu edu 80 Connected to euro ecom cmu edu Escape character is Request sent by client Response sent by server GET test html HTTP 1 1 request line Host euro ecom cmu edu request hdr CRLF HTTP 1 1 200 OK status line Date Thu 22 Jul 1999 03 37 04 GMT response hdr Server Apache 1 3 3 Ben SSL 1 28 Unix Last Modified Thu 22 Jul 1999 03 33 21 GMT ETag 48bb2 4f 37969101 Accept Ranges bytes Content Length 79 Content Type text html CRLF html beginning of 79 byte message body content head title Test page title head body h1 Test page h1 html class26 ppt 13 CS 213 F 00 OPTIONS method Retrieves information about the server in general or resources on that server without actually retrieving the resource Request URIs if request URI then the request is about the server in general Is the server up Is it HTTP 1 1 compliant What brand of server What OS is it running if request URI then the request applies to the options that available when accessing that resource what methods can the client use to access the resource class26 ppt 14 CS 213 F 00 OPTIONS euro ecom Host is a required header in HTTP 1 1 but not in HTTP 1 0 class26 ppt kittyhawk telnet euro ecom cmu edu 80 Trying 128 2 218 2 Connected to euro ecom cmu edu Escape character is OPTIONS HTTP 1 1 Host euro ecom cmu edu Request CRLF HTTP 1 1 200 OK Response Date Thu 22 Jul 1999 06 12 11 GMT Server Apache 1 3 3 Ben SSL 1 28 Unix Content Length 0 Allow GET HEAD OPTIONS TRACE 15 CS 213 F 00 OPTIONS amazon com kittyhawk telnet amazon com 80 Trying 208 216 182 15 Connected to amazon com Escape character is OPTIONS HTTP 1 0 CRLF HTTP 1 0 405 Because I felt like it Server Netscape Commerce 1 12 Date Thursday 22 Jul 99 04 17 32 GMT Allow GET POST Content type text plain class26 ppt 16 Request Response CS 213 F 00 GET method Retrieves the information identified by the request URI static content HTML file dynamic content produced by CGI program passes arguments to CGI program in URI Can also act as a conditional retrieve when certain request headers are present If Modified Since If Unmodified Since If Match If None Match If Range Conditional GETs useful for caching class26 ppt 17 CS 213 F 00 GET euro ecom cmu edu kittyhawk
View Full Document