Web 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 adistributed hypertext system.–connects “a web of notes with links”.–intended to help CERN physicists in large projects share andmanage information1990:• 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 "MosaicCommunications Corp" (now Netscape).CS 213 F’00– 4 –class26.pptInternet Domain Survey(www.isc.org)1001,00010,000100,0001,000,00010,000,000100,000,000Aug-81Oct-84Nov-86Oct-88Oct-89Jul-91Apr-92Jan-93Oct-93Oct-94Jan-96Jul-97Jan-99Internet hostsMosaicandNetscapeCS 213 F’00– 5 –class26.pptWeb serverswebserverHTTP requestHTTP response(content)Clients and serverscommunicate usingthe HyperText TransferProtocol (HTTP)• client and server establishTCP connection• Client requests content• Server responds withrequested content• client and server closeconnection (usually)Current version isHTTP/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 eitherstatic 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 theserver on behalf of the client.CS 213 F’00– 8 –class26.pptURIs and URLsnetwork resources are identified by UniversalResource Indicators (URIs)The most familiar is the absolute URI known as theHTTP 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>Requestsent byclientResponsesent byserverCS 213 F’00– 14 –class26.pptOPTIONS methodRetrieves information about the server in general orresources on that server, without actually retrievingthe 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 thatavailable when accessing that resource:–what methods can the client use to access the resource?CS 213 F’00– 15 –class26.pptOPTIONS (euro.ecom)kittyhawk> telnet euro.ecom.cmu.edu 80Trying 128.2.218.2...Connected to euro.ecom.cmu.edu.Escape character is '^]'.OPTIONS * HTTP/1.1Host: euro.ecom.cmu.eduCRLFHTTP/1.1 200 OKDate: Thu, 22 Jul 1999 06:12:11 GMTServer: Apache/1.3.3 Ben-SSL/1.28 (Unix)Content-Length: 0Allow: GET, HEAD, OPTIONS, TRACERequestResponseHost is arequiredheader inHTTP/1.1but not inHTTP/1.0CS 213 F’00– 16 –class26.pptOPTIONS (amazon.com)kittyhawk> telnet amazon.com 80Trying
View Full Document