Web services Nov 28, 2000Web historyWeb history (cont)Internet Domain Survey (www.isc.org)Web serversWeb server statisticsStatic and dynamic contentURIs and URLsHTTP/1.1 messagesHTTP/1.1 requestsHTTP/1.1 responsesHow servers interpret Request-URIsExample HTTP/1.1 conversationOPTIONS methodOPTIONS (euro.ecom)OPTIONS (amazon.com)GET methodGET (euro.ecom.cmu.edu)GET request to euro.ecom (Internet Explorer browser)GET response from euro.ecomGET request to euro.ecom (Netscape browser)Slide 22HEAD methodHEAD (etrade.com)HEAD (espn.com)POST methodPOST requestPOST responseTRACE, PUT, and DELETE methodsServing dynamic contentSlide 31Slide 32Slide 33Issues in serving dynamic contentCGIadd.com: THE Internet addition portal!The add.com experienceServing dynamic content with GETSlide 39Slide 40Slide 41Some CGI environment variablesSlide 43Slide 44Serving dynamic content with GETWeb services Nov 28, 2000Topics•HTTP•Serving static content•Serving dynamic contentclass26.ppt15-213“The course that gives CMU its Zip!”CS 213 F’00– 2 –class26.pptWeb history1945: •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.CS 213 F’00– 3 –class26.pptWeb history (cont)1992•NCSA server released•26 WWW servers worldwide1993•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).CS 213 F’00– 4 –class26.pptInternet Domain Survey(www.isc.org)1001,00010,000100,0001,000,00010,000,000100,000,000Internet hostsMosaicandNetscapeCS 213 F’00– 5 –class26.pptWeb serverswebserverHTTP requestHTTP response(content)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)Current version is HTTP/1.1•RFC 2616, June, 1999. webclient(browser)CS 213 F’00– 6 –class26.pptWeb server statisticssource: Netcraft Web Survey www.netcraft.com/survey ApacheMicrosoftOtherMosaicNetscapeCS 213 F’00– 7 –class26.pptStatic and dynamic contentThe 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 clipsDynamic 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.CS 213 F’00– 8 –class26.pptURIs and URLsnetwork 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.htmlExamples (all equivalent):•http://www.cs.cmu.edu:80/index.html•http://www.cs.cmu.edu/index.html•http://www.cs.cmu.eduCS 213 F’00– 9 –class26.pptHTTP/1.1 messagesAn 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 = Request-line | Status linemessage-header = field-name “:” [field value] CRLFmessage-body = <e.g., HTML file>CS 213 F’00– 10 –class26.pptHTTP/1.1 requestsRequest = 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 capabilitiesRequest-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 charactersCS 213 F’00– 11 –class26.pptHTTP/1.1 responsesResponse = HTTP-Version SP Status-Code SP Reason-Phrase CRLF *(general-header | response-header | entity header) CRLF [ message-body ]Status code: 3-digit numberReason-Phrase: explanation of status codeheaders: 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/htmlmessage-body:•fileCS 213 F’00– 12 –class26.pptHow servers interpret Request-URIsGET / HTTP/1.1•resolves to home/html/index.html•action: retrieves index.htmlGET /index.html HTTP/1.1•resolves to home/html/index.html•action: retrieves index.htmlGET /foo.html HTTP/1.1•resolves to home/html/foo.html•action: retrieves foo.htmlGET /cgi-bin/test.pl HTTP/1.1•resolves to home/cgi-bin/test.pl•action: runs test.plGET http://euro.ecom.cmu.edu/index.html HTTP/1.1•resolves to home/html/index.html•action: retrieves index.htmlhomecgi-bin htmltest.pl index.html foo.htmlCS 213 F’00– 13 –class26.pptExample HTTP/1.1 conversationkittyhawk> telnet euro.ecom.cmu.edu 80Connected to euro.ecom.cmu.edu.Escape character is '^]'.GET /test.html HTTP/1.1 ;request lineHost: euro.ecom.cmu.edu ;request hdrCRLFHTTP/1.1 200 OK ;status lineDate: Thu, 22 Jul 1999 03:37:04 GMT ;response hdrServer: Apache/1.3.3 Ben-SSL/1.28 (Unix)Last-Modified: Thu, 22 Jul 1999 03:33:21 GMTETag: "48bb2-4f-37969101"Accept-Ranges: bytesContent-Length: 79Content-Type: text/htmlCRLF<html> ;beginning of 79 byte message body (content)<head><title>Test page</title></head><body><h1>Test page</h1></html>Request sent by clientResponse sent by serverCS 213 F’00– 14 –class26.pptOPTIONS methodRetrieves information about the server in general or resources on that server, without actually retrieving the resource.Request URIs:•if request URI = “*”, then
View Full Document