Web ServicesApril 24, 2007TopicsTopics HTTP Serving static content Serving dynamic content Proxies15-213“The course that gives CMU its Zip!”24-webservices.ppt– 2 –15-213, S’07History of the Web1945:1945: Vannevar Bush, “As we may think”, AtlanticMonthly, July, 1945. Describes the idea of a distributed hypertext system. A “Memex” that mimics the “web of trails” in ourminds.1989:1989: Tim Berners-Lee (CERN) writes internal proposalto develop a distributed hypertext system. Connects “a web of notes with links.” Intended to help CERN physicists in large projectsshare and manage information1990:1990: Sir Tim BL writes a graphical browser for NeXTmachines, and first web server ‘httpd’– 3 –15-213, S’07Web History (cont)19921992 NCSA server released 26 WWW servers worldwide19931993 Marc Andreessen releases first version of NCSA Mosaicbrowser (killer app of the 90’s) Mosaic version released for (Windows, Mac, Unix). Web (port 80) traffic at 1% of NSFNET backbone traffic. Over 200 WWW servers worldwide.19941994 Andreessen and colleagues leave NCSA to form “MosaicCommunications Corp” (predecessor to Netscape).– 4 –15-213, S’07Internet HostsSource: www.isc.org– 5 –15-213, S’07World Wide Web Traffic (US)1.1.YahooYahoo2.2.GoogleGoogle3.3.MyspaceMyspace4.4.MSNMSN5.5.EbayEbay6.6.YoutubeYoutube7.7.FacebookFacebook8.8.WikipediaWikipedia9.9.CraigslistCraigslist10.10.Windows liveWindows liveCaveat: alexa.com representative?– 6 –15-213, S’07Web TransactionWebserverHTTP requestHTTP response(content)Clients and serversClients and serverscommunicate using thecommunicate using theHyperText HyperText TransferTransferProtocol (HTTP)Protocol (HTTP) Client and serverestablish TCP connection Client requests content Server responds withrequested content Client and server closeconnection (usually)Current version is HTTP/1.1Current version is HTTP/1.1 RFC 2616, June, 1999.Webclient(browser)– 7 –15-213, S’07HTTP ProtocolGET / HTTP/1.1 Client: request linehost: www.aol.com Client: required HTTP/1.1 HOST header Client: empty line terminates headers.HTTP/1.0 200 OK Server: response lineMIME-Version: 1.0 Server: followed by five response headersDate: Mon, 08 Jan 2001 04:59:42 GMTServer: NaviServer/2.0 AOLserver/2.3.3Content-Type: text/html Server: expect HTML in the response bodyContent-Length: 42092 Server: expect 42,092 bytes in the resp body Server: empty line (“\r\n”) terminates hdrs<html> Server: first HTML line in response body... Server: 766 lines of HTML not shown.</html> Server: last HTML line in response bodyConnection closed by foreign host. Server: closes connectionunix> Client: closes connection and terminates– 8 –15-213, S’07Web ContentWeb servers return Web servers return contentcontent to clients to clientscontent: a sequence of bytes with an associated MIME(Multipurpose Internet Mail Extensions) typeExample MIME typesExample MIME types text/html HTML document text/plain Unformatted text application/postscript Postcript document image/gif Binary image encoded in GIF format image/jpeg Binary image encoded in JPEG format– 9 –15-213, S’07Static and Dynamic ContentThe content returned in HTTP responses can be eitherThe content returned in HTTP responses can be eitherstaticstatic or or dynamicdynamic.. Static content: content stored in files and retrieved inresponse to an HTTP request Examples: HTML files, images, audio clips. Dynamic content: content produced on-the-fly in responseto an HTTP request Example: content produced by a program executed by theserver on behalf of the client.Bottom line: Bottom line: All Web content is associated with a fileAll Web content is associated with a filethat is managed by the server.that is managed by the server.– 10 –15-213, S’07URLsEach file managed by a server has a unique name called aEach file managed by a server has a unique name called aURL (Universal Resource Locator)URL (Universal Resource Locator)URLs for static content:URLs for static content: http://www.cs.cmu.edu:80/index.html http://www.cs.cmu.edu/index.html http://www.cs.cmu.edu Identifies a file called index.html, managed by a Web server atwww.cs.cmu.edu that is listening on port 80.URLs for dynamic content:URLs for dynamic content: http://www.cs.cmu.edu:8000/cgi-bin/adder?15000&213 Identifies an executable file called adder, managed by a Webserver at www.cs.cmu.edu that is listening on port 8000, thatshould be called with two argument strings: 15000 and 213.– 11 –15-213, S’07How Clients and Servers Use URLsExample URL: Example URL: http://www.http://www.aolaol.com:80.com:80/index.html/index.htmlClients use Clients use prefixprefix ((http://www.http://www.aolaol.com:80.com:80) to infer:) to infer: What kind of server to contact (Web server) Where the server is (www.aol.com) What port it is listening on (80)Servers use Servers use suffixsuffix ( (/index.html/index.html) to:) to: Determine if request is for static or dynamic content. No hard and fast rules for this. Convention: executables reside in cgi-bin directory Find file on file system. Initial “/” in suffix denotes home directory for requestedcontent. Minimal suffix is “/”, which all servers expand to some defaulthome page (e.g., index.html).– 12 –15-213, S’07Anatomy of an HTTP Transactionunix> telnet www.aol.com 80 Client: open connection to serverTrying 205.188.146.23... Telnet prints 3 lines to the terminalConnected to aol.com.Escape character is '^]'.GET / HTTP/1.1 Client: request linehost: www.aol.com Client: required HTTP/1.1 HOST header Client: empty line terminates headers.HTTP/1.0 200 OK Server: response lineMIME-Version: 1.0 Server: followed by five response headersDate: Mon, 08 Jan 2001 04:59:42 GMTServer: NaviServer/2.0 AOLserver/2.3.3Content-Type: text/html Server: expect HTML in the response bodyContent-Length: 42092 Server: expect 42,092 bytes in the resp body Server: empty line (“\r\n”) terminates hdrs<html> Server: first HTML line in response body... Server: 766 lines of HTML not shown.</html> Server: last HTML line in response bodyConnection closed by foreign host. Server: closes connectionunix> Client: closes connection and terminates–
View Full Document