WebservicesApril24,2001Topics• HTTP• Servingstaticcontent• Servingdynamiccontentclass26.ppt15-213“ThecoursethatgivesCMUitsZip!”CS213S’01– 2 –class26.pptWebhistory1945:• Vannevar Bush,“Aswemaythink”,AtlanticMonthly,July,1945.–Describestheideaofadistributedhypertextsystem.–a“memex”thatmimicsthe“weboftrails”inourminds.1989:• TimBerners-Lee(CERN)writesinternalproposaltodevelopadistributedhypertextsystem.–connects“awebofnoteswithlinks”.–intendedtohelpCERNphysicistsinlargeprojectsshareandmanageinformation1990:• TimBLwritesagraphicalbrowserforNextmachines.CS213S’01– 3 –class26.pptWebhistory(cont)1992• NCSAserverreleased• 26WWWserversworldwide1993• MarcAndreessen releasesfirstversionofNCSAMosaicbrowser• Mosaicversionreleasedfor(Windows,Mac,Unix).• Web(port80)trafficat1%ofNSFNETbackbonetraffic.• Over200WWWserversworldwide.1994• Andreessen andcolleaguesleaveNCSAtoform"MosaicCommunicationsCorp"(nowNetscape).CS213S’01– 4 –class26.pptInternetDomainSurvey(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-99InternethostsMosaicandNetscapeCS213S’01– 5 –class26.pptWebserverswebserverHTTPrequestHTTPresponse(content)ClientsandserverscommunicateusingtheHyperText TransferProtocol(HTTP)• clientandserverestablishTCPconnection• Clientrequestscontent• Serverrespondswithrequestedcontent• clientandservercloseconnection(usually)CurrentversionisHTTP/1.1• RFC2616,June,1999.webclient(browser)CS213S’01– 6 –class26.pptWebserverstatisticssource:NetcraftWebSurveywww.netcraft.com/surveyApacheMicrosoftOtherMosaicNetscapeCS213S’01– 7 –class26.pptStaticanddynamiccontentThecontentreturnedinHTTPresponsescanbeeitherstaticordynamic.Staticcontent:• contentstoredinfilesandretrievedinresponsetoanHTTPrequest–HTMLfiles–images–audioclipsDynamiccontent:• contentproducedon-the-flyinresponsetoanHTTPrequest–Example:contentproducedbyaCGIprocessexecutedbytheserveronbehalfoftheclient.CS213S’01– 8 –class26.pptURIsandURLsnetworkresourcesareidentifiedbyUniversalResourceIndicators(URIs)ThemostfamiliaristheabsoluteURIknownastheHTTPURL:• http-url =“http:”“//”host[“:”port][abs_path]• port defaultsto“80”• abs_path defaultsto“/”• abs_path endingin/defaultsto…/index.htmlExamples(allequivalent):• http://www.cs.cmu.edu:80/index.html• http://www.cs.cmu.edu/index.html• http://www.cs.cmu.eduCS213S’01– 9 –class26.pptHTTP/1.1messagesAnHTTPmessageiseitheraRequestoraResponse:HTTP-message=Request|ResponseRequestsandresponseshavethesamebasicform:generic-message=start-line*message-headerCRLF[messagebody]start-line=Request-line|Statuslinemessage-header=field-name“:”[fieldvalue]CRLFmessage-body=<e.g.,HTMLfile>CS213S’01– 10 –class26.pptHTTP/1.1requestsRequest=MethodSPRequest-URISPHTTP-VERSIONCRLF*(general-header|request-header|entityheader)CRLF[message-body]Method:tellstheserverwhatoperationtoperform,e.g.,• GET:servestaticordynamiccontent• POST:servedynamiccontent• OPTIONS:retrieveserverandaccesscapabilitiesRequest-URI:identifiestheresourcetomanipulate• datafile(HTML),executablefile(CGI)headers:parameterizethemethod• Accept-Language:en-us• User-Agent:Mozilla/4.0(compatible;MSIE4.01;Windows98)message-body:textcharactersCS213S’01– 11 –class26.pptHTTP/1.1responsesResponse=HTTP-VersionSPStatus-CodeSPReason-PhraseCRLF*(general-header|response-header|entityheader)CRLF[message-body]Statuscode:3-digitnumberReason-Phrase:explanationofstatuscodeheaders:parameterizetheresponse• Date:Thu,22Jul199923:42:18GMT• Server:Apache/1.2.5BSDI3.0-PHP/FI-2.0• Content-Type:text/htmlmessage-body:• fileCS213S’01– 12 –class26.pptHowserversinterpretRequest-URIsGET/HTTP/1.1• resolvestohome/html/index.html•action:retrievesindex.htmlGET/index.htmlHTTP/1.1• resolvesto home/html/index.html•action:retrievesindex.htmlGET/foo.htmlHTTP/1.1• resolvesto home/html/foo.html•action:retrievesfoo.htmlGET/cgi-bin/test.plHTTP/1.1• resolvesto home/cgi-bin/test.pl•action:runstest.plGEThttp://euro.ecom.cmu.edu/index.htmlHTTP/1.1• resolvesto home/html/index.html•action:retrievesindex.htmlhomecgi-bin htmltest.pl index.html foo.htmlCS213S’01– 13 –class26.pptExampleHTTP/1.1conversationkittyhawk>telneteuro.ecom.cmu.edu
View Full Document