class26 ppt HTTP Serving static content Serving dynamic content Topics Web services April 24 2001 The course that gives CMU its Zip 15 213 class26 ppt 2 CS 213 S 01 Tim BL writes a graphical browser for Next machines 1990 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 1989 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 1945 Web history 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 class26 ppt 3 CS 213 S 01 Andreessen and colleagues leave NCSA to form Mosaic Communications Corp now Netscape 1994 1993 NCSA server released 26 WWW servers worldwide 1992 Web history cont Internet hosts 1 class26 ppt Au 8 g 100 1 000 10 000 100 000 1 000 000 10 000 000 100 000 000 c O 4 t 8 N o 86 v c O 8 t 8 c O 9 t 8 J Ap 3 9 nJa 2 r 9 4 1 9 ul c O 3 t 9 CS 213 S 01 7 4 6 9 9 n 9 t 9 n 9 l c Ju Ja O Ja Internet Domain Survey www isc org Mosaic and Netscape class26 ppt RFC 2616 June 1999 Current version is HTTP 1 1 client and server establish TCP connection Client requests content Server responds with requested content client and server close connection usually Clients and servers communicate using the HyperText Transfer Protocol HTTP 5 web client browser web server CS 213 S 01 HTTP response content HTTP request Web servers class26 ppt Mosaic 6 Netscape Other source Netcraft Web Survey www netcraft com survey CS 213 S 01 Microsoft Apache Web server statistics class26 ppt 7 CS 213 S 01 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 Dynamic content content stored in files and retrieved in response to an HTTP request HTML files images audio clips The content returned in HTTP responses can be either static or dynamic Static content Static and dynamic content class26 ppt 8 http www cs cmu edu 80 index html http www cs cmu edu index html http www cs cmu edu CS 213 S 01 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 network resources are identified by Universal Resource Indicators URIs The most familiar is the absolute URI known as the HTTP URL URIs and URLs class26 ppt start line message header message body 9 CS 213 S 01 Request line Status line field name field value CRLF e g HTML file generic message start line message header CRLF message body Requests and responses have the same basic form HTTP message Request Response An HTTP message is either a Request or a Response HTTP 1 1 messages class26 ppt 10 message body text characters CS 213 S 01 Accept Language en us User Agent Mozilla 4 0 compatible MSIE 4 01 Windows 98 headers parameterize the method data file HTML executable file CGI Request URI identifies the resource to manipulate GET serve static or dynamic content POST serve dynamic content OPTIONS retrieve server and access capabilities Method tells the server what operation to perform e g Request Method SP Request URI SP HTTP VERSION CRLF general header request header entity header CRLF message body HTTP 1 1 requests class26 ppt file message body 11 Date Thu 22 Jul 1999 23 42 18 GMT Server Apache 1 2 5 BSDI3 0 PHP FI 2 0 Content Type text html CS 213 S 01 Status code 3 digit number Reason Phrase explanation of status code headers parameterize the response Response HTTP Version SP Status Code SP Reason Phrase CRLF general header response header entity header CRLF message body HTTP 1 1 responses test pl cgi bin html index html foo html home class26 ppt 12 resolves to home html index html action retrieves index html CS 213 S 01 GET http euro ecom cmu edu index html HTTP 1 1 resolves to home cgi bin test pl action runs test pl GET cgi bin test pl HTTP 1 1 resolves to home html foo html action retrieves foo html GET foo html HTTP 1 1 resolves to home html index html action retrieves index html GET index html HTTP 1 1 action retrieves index html resolves to home html index html GET HTTP 1 1 How servers interpret Request URIs 13 CS 213 S 01 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 Response sent by server Request sent by client kittyhawk telnet euro ecom cmu edu 80 Connected to euro ecom cmu edu Escape character is Example HTTP 1 1 conversation class26 ppt 14 CS 213 S 01 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 Retrieves information about the server in general or resources on that server without actually retrieving the resource Request URIs OPTIONS method class26 ppt Host is a required header in HTTP 1 1 but not in HTTP 1 0 15 CS 213 S 01 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 kittyhawk telnet euro ecom cmu edu 80 Trying 128 2 218 2 Connected to euro ecom cmu edu Escape character is OPTIONS euro ecom class26 ppt 16 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 kittyhawk telnet amazon com 80 Trying 208 216 182 15 Connected to amazon com Escape character is Response Request CS 213 S 01 OPTIONS amazon com If Modified Since If Unmodified Since If Match If None Match If Range class26 ppt …
View Full Document