1 / 68

Chapte r 8

Chapte r 8. Ap p lication L ayer. Compiled By: Ashish Kr. Jha. 2. Hype r tex t T ran sfer P rotocol (HTT P ) In t er n e t (o r The Web ) i s a d i str i bu t e d cli e nt/s e rver info r mat i on sys t e m .

lora
Download Presentation

Chapte r 8

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter8 ApplicationLayer Compiled By: Ashish Kr. Jha

  2. 2 • HypertextTransferProtocol(HTTP) • Internet(orTheWeb)isadistributedclient/serverinformation • system. • ManyapplicationsarerunningconcurrentlyovertheWeb,suchaswebbrowsing/surfing,e-mail,filetransfer,audio&videostreaming,andsoon.Inorderforpropercommunicationtotakeplacebetweentheclientandtheserver,theseapplicationsmustagreeonaspecificapplication-levelprotocolsuchasHTTP,FTP,SMTP,POP,andetc. Compiled By: Ashish Kr. Jha

  3. 3 • HypertextTransferProtocol(HTTP) • HTTP(HypertextTransferProtocol)isperhapsthemost • popularapplicationprotocolusedintheInternet(orTheWEB). • HTTPisanasymmetricrequest-responseclient-serverprotocol.AnHTTPclientsendsarequestmessagetoanHTTPserver.Theserver,inturn,returnsaresponsemessage.Inotherwords,HTTPisapullprotocol,theclientpullsinformationfromtheserver(insteadofserverpushesinformationdowntotheclient). Compiled By: Ashish Kr. Jha

  4. 4 • HypertextTransferProtocol(HTTP) • Webserverlistenatportnumber80. • HTTPisimplementedintwoprograms:aclientprogramandserverprogram. • Theclientprogramandserverprograms,executingondifferentendsystems,talktoeachotherbyexchangingHTTPmessages. • HTTPdefinesthestructureofthesemessagesandhowthe • clientandserverexchangethemessages. • HTTPisastatelessprotocol.Inotherwords,thecurrentrequestdoesnotknowwhathasbeendoneinthepreviousrequests. • HTTPpermitsnegotiatingofdatatypeandrepresentation,soastoallowsystemstobebuiltindependentlyofthedatabeingtransferred. • UsesTCPasunderlyingtransportprotocol Compiled By: Ashish Kr. Jha

  5. 5 • HTTP • AWebpage(alsocalledadocument)consistsofobjects.Anobjectisasimplyfile--suchasaHTMLfile,aJPEGimage,aGIFimage,aJavaapplet,anaudioclip,etc.--thatisaddressablebyasingleURL.MostWebpagesconsistofabaseHTMLfileandseveralreferencedobjects. • Forexample,ifaWebpagecontainsHTMLtextandfiveJPEGimages,thentheWebpagehassixobjects:thebaseHTMLfileplusthefiveimages.ThebaseHTMLfilereferencestheotherobjectsinthepagewiththeobjects'URLs. • EachURLhastwocomponents:thehostnameoftheserverthathousestheobjectandtheobject'spathname. • Forexample,theURLwww.someSchool.edu/someDepartment/picture.gifhaswww.someSchool.eduforahostnameand • /someDepartment/picture.gifforapathname. Compiled By: Ashish Kr. Jha

  6. 6 • HTTP • WheneveryouissueaURLfromyourbrowsertogetawebresourceusingHTTP,e.g.http://www.test101.com/index.html,thebrowserturnstheURLintoarequestmessageandsendsittotheHTTPserver.TheHTTPserverinterpretstherequestmessage,andreturnsyouanappropriateresponsemessage,whichiseithertheresourceyourequestedoranerrormessage.Thisprocessisillustratedbelow: Compiled By: Ashish Kr. Jha

  7. 7 • HTTP/1.0non-persistentconnection • SingleHTTPRequestandResponseallowedforeachTCP • Connection • www.someSchool.edu/someDepartment/home.index Compiled By: Ashish Kr. Jha

  8. 8 • HTTP/1.0non-persistentconnection • www.someSchool.edu/someDepartment/home.index Compiled By: Ashish Kr. Jha

  9. 9 Timingofanon-persistentconnection Compiled By: Ashish Kr. Jha

  10. 10 • HTTP/1.1persistentconnection • Assizeofwebpagesincreased,HTTP1.0wasnomore • efficient • WithHTTP1.1,itwaspossibletosendadditionalrequests • andgetadditionalresponsesinasingleTCPconnection. • InanHTTP/1.1persistentconnection,theserverleavestheTCPconnectionopenaftersendingaresponse. • Subsequentrequestsandresponses(pipelinedornot) • betweenthesameclientcanbesentonthesameconnection. Compiled By: Ashish Kr. Jha

  11. 11 • HTTPRequestMessage • HTTPrequestmessageconsistsof: • RequestLine • request-method-namerequest-URIHTTP-version • RequestHeaders • request-header-name:request-header-value1,request-header-value2... • RequestMessageBody Compiled By: Ashish Kr. Jha

  12. 12 • HTTPRequestMethods • HTTPprotocoldefinesasetofrequestmethods.AclientcanuseoneoftheserequestmethodstosendarequestmessagetoanHTTPserver. • ▫ GET:AclientcanusetheGETrequesttogetawebresourcefromtheserver. • ▫ HEAD:AclientcanusetheHEADrequesttogettheheaderthataGETrequestwouldhaveobtained.Sincetheheadercontainsthelast-modifieddateofthedata,thiscanbeusedtocheckagainstthelocalcachecopy. • ▫ POST:Usedtopostdatauptothewebserver. • ▫ PUT:Asktheservertostorethedata. • ▫ DELETE:Asktheservertodeletethedata. • ▫ TRACE:Asktheservertoreturnadiagnostictraceoftheactionsittakes. • ▫ OPTIONS:Asktheservertoreturnthelistofrequestmethodsit • supports. • ▫ CONNECT:Usedtotellaproxytomakeaconnectiontoanotherhostandsimplyreplythecontent,withoutattemptingtoparseorcacheit.ThisisoftenusedtomakeSSLconnectionthroughtheproxy. Compiled By: Ashish Kr. Jha

  13. 13 • HTTPResponseMessage • HTTPResponsemessageconsistsof: • ▫ StatusLine • HTTP-versionstatus-codereason-phrase • ▫ ResponseHeader • response-header-name:response-header-value1,response-header-value2,... ▫ ResponseMessageBody Compiled By: Ashish Kr. Jha

  14. 14 • SomeHTTPresponsestatuscodes • • 200OK • ▫ requestsucceeded,requestedobjectinthismessage • 301MovedPermanently • ▫ requestedobjectmoved, • message(Location) • 304NotModified newlocationspecifiedin this • ▫ InresponsetotheIf-Modified-SinceconditionalGETrequest,theservernotifiesthattheresourcerequestedhasnotbeenmodified. • 400BadRequest • ▫ requestmessagenotunderstoodbyserver • 404NotFound • ▫ requesteddocumentnotfoundonthisserver • 408RequestTimeout • 505HTTPVersionNotSupported. Compiled By: Ashish Kr. Jha

  15. 15 • HTTPS • UseTCPatTransportlayer. • Listenatportnumber443. • HypertextTransferProtocolSecure(HTTPS)isawidely-usedcommunicationsprotocolforsecurecommunicationoveracomputernetwork,withespeciallywidedeploymentontheInternet. • Technically,itisnotaprotocolinitself;rather,itistheresultofsimplylayeringtheHypertextTransferProtocol(HTTP)ontopof theSSL (SecureSocketLayer)orTLS(TransportLayer protocol,thusaddingthesecuritycapabilitiesof Security) • SSL/TLStostandardHTTPcommunications. • NeedtorequesttheSSLcertificatefromtheCertificateAuthoritytodeployHTTPS. • Encryption/DecryptionMechanismisusedbetweenclientandserverfortransferringdata. • LikefromGoDaddy,VeriSignetc. Compiled By: Ashish Kr. Jha

  16. 16 HTTPS Compiled By: Ashish Kr. Jha

  17. 17 • FileTransferProtocol(FTP) • FTP,likeHTTP,runsontopofTCP. • However,unlikeHTTP,FTPusestwo parallelTCP • connectionstotransferafile,acontrolconnection(port#21)andadataconnection(port#20).WesayFTPsendsitscontrolinformationout-ofband. • AlsounlikeHTTP,FTPmaintainsstate.Inparticular,FTPremembersthecurrentdirectoryandearlierauthentication. Compiled By: Ashish Kr. Jha

  18. 18 • FileTransferProtocol(FTP) • Protocolforexchangingfilesfromonehosttoanotherhost • typicallyformyourcomputertoawebserver. • Thetransferisasynchronous,meaningnotatthesametime, • andthereforefasterthanotherprotocols. • Downloading– • ▫ copyingfilestoyourcomputer • Uploading– • ▫ transmitafilefromyoucomputertoanothercomputeroninternet Compiled By: Ashish Kr. Jha

  19. 19 • FileTransferProtocol(FTP) • FTPestablishestwoconnectionsbetween theclientand • server. • Oneisfordatatransferandtheotherisforthecontrol • information. • Thecontrolconnectionusessimplerulesofcommunication.Onlyonelineofcommandoralineofresponseistransferredatatime. • Butthedataconnectionusesmorecomplexrulesdueto • varietyofdatatypesbeingtransferred. • FTPusesport21forcontrolconnectionandport20forthe • dataconnection. • ControlconnectionismaintainedduringtheentireFTPsession. • Thedataconnectionisfirstopened,fileistransferredand • connectionisclosed.Thisisdonefortransferringeachfile. Compiled By: Ashish Kr. Jha

  20. 20 FileTransferProtocol(FTP) Compiled By: Ashish Kr. Jha

  21. 21 FTPExample Compiled By: Ashish Kr. Jha

  22. 22 • WinSCP • WinSCP(WindowsSecureCoPy)isafreeandopensource • SFTP,SCP,andFTPclientforMicrosoftWindows. • Itsmainfunctionissecurefiletransferbetweenalocalanda • remotecomputer. • Beyondthis,WinSCPoffersbasicfilemanagerandfilesynchronizationfunctionality. • Forsecuretransfers,itusesSecureShell(SSH)andsupports • theSCPprotocolinadditiontoSFTP. • WinSCPisbasedontheimplementationoftheSSHprotocolfromPuTTYandFTPprotocolfromFileZilla. Compiled By: Ashish Kr. Jha

  23. 23 WinSCP Compiled By: Ashish Kr. Jha

  24. 24 • PuTTY • PuTTYisafreeandopensourceterminalemulatorapplicationwhichcanactasaclientfortheSSH,Telnet,rlogin,andrawTCPcomputingprotocolsandasaserialconsoleclient. • Thename"PuTTY"hasnodefinitivemeaning,though"tty"isthenameforaterminalintheUnixtradition,usuallyheldtobeshortforTeletype. Compiled By: Ashish Kr. Jha

  25. 25 PuTTY Compiled By: Ashish Kr. Jha

  26. 26 • ElectronicMail • MailSendProtocol • ▫ SimpleMailTransferProtocol(SMTP) • PortNumber25/TCP • RelayMailFromOnedomaintoanotherorwithinsamedomain • MailAccessProtocol • ▫ PostOfficeProtocolv3(POP3) • Portnumber110/TCP • AccessmailfromMailserver • ▫ InternetMailAccessProtocol(IMAP) • WebBasedmailaccessprotocol • PortNumber143/TCP Compiled By: Ashish Kr. Jha

  27. 27 HighLevelViewofE-mailSystem Compiled By: Ashish Kr. Jha

  28. 28 SampleSMTPInteraction ▫ S:220hamburger.edu ▫ C:HELOcrepes.fr ▫ S:250Hellocrepes.fr,pleasedtomeetyou ▫ C:MAILFROM:<alice@crepes.fr> ▫ S:250alice@crepes.fr...Senderok ▫ C:RCPTTO:<bob@hamburger.edu> ▫ S:250bob@hamburger.edu...Recipientok ▫ C:DATA ▫ S:354Entermail,endwith"."onalinebyitself ▫ C:Doyoulikeketchup? ▫ C:Howaboutpickles? ▫ C:. ▫ S:250Messageacceptedfordelivery ▫ C:QUIT ▫ S:221hamburger.educlosingconnection Compiled By: Ashish Kr. Jha

  29. 29 E-mailSystem WhenbothsenderandreceiverareconnectedtothemailserverviaaLANoraWAN,weneedtwoUAs,twopairsofMTAs(clientandserver),andapairofMAAs(clientandserver).Thisisthemostcommonsituationtoday. Compiled By: Ashish Kr. Jha

  30. 30 • ComponentsofEmailSystem • UserAgent • ▫ Thefirstcomponentofanelectronicmailsystemistheuseragent(UA).Itprovidesservicetotheusertomaketheprocessofsendingandreceivingamessageeasier. • MessageTransferAgent • ▫ Theactualmailtransferisdonethroughmessagetransferagents(MTAs).Tosendmail,asystemmusthavetheclientMTA,andtoreceivemail,asystemmusthaveaserverMTA.TheformalprotocolthatdefinestheMTAclientandserverintheInternetiscalledSimpleMailTransferProtocol(SMTP).TwopairsofMTAclient-serverprogramsareusedinthemostcommonsituation. • MessageAccessAgents • ▫ ThefirstandthesecondstagesofmaildeliveryuseSMTP.However,SMTPisnotinvolvedinthethirdstagebecauseSMTPisapushprotocol;itpushesthemessagefromtheclienttotheserver.Ontheotherhand,thethirdstageneedsapullprotocol;theclientmustpullmessagesfromtheserver.Thethirdstageusesamessageaccessagent. Compiled By: Ashish Kr. Jha

  31. 31 • SMTP(SimpleMailTransferProtocol) • SMTPisaprincipleapplication-layerprotocolforInternet • e-mail. • ItusesthereliabletransferserviceofTCP,usesport25 • Directtransfer:sendingservertoreceivingserver • Threephasesoftransfer: • ▫ 1)handshaking(greeting) • 3)closure • Messagesmustbein7-bitASCII • 7-bitASCIIrestrictionisabit 2)transferofmessages ofpain:-requiresbinary multimediadatatobeencodedtoASCIIbeforebeingsent overSMTP Compiled By: Ashish Kr. Jha

  32. 32 SendEmail Compiled By: Ashish Kr. Jha

  33. 33 Scenario:AlicesendsmessagetoBob SMTPclientsendsAlice’s messageovertheTCPconnection Bob’smailserverplacesthe messagein Bob’smailbox 6)Bobinvokeshisuseragenttoreadmessage 1)AliceusesUAtocomposemessageto:bob@someschool.edu 2)Alice’s UAsendsmessageto hermailserver;messageplacedinmessagequeue 3)ClientsideofSMTPopensTCPconnectionwith Bob’s mailserver 1 useragent mail server mail user agent server 2 6 3 4 5 Compiled By: Ashish Kr. Jha

  34. 34 • MailAccessProtocols(PullProtocols) • SMTPwasaMailTransferProtocolorpushProtocolandusedto • pushthemailmessageup tothereceiver’smailserver. • MailAccessProtocol:retrievalfromserver • ▫ HTTPisalsousedtoComposeandretrieveEmails. • ▫ AlsocalledWebbasedemail. • ▫ Eg.Hotmail,YahooMailEtc. • POP:PostOfficeProtocol(POP3) • ▫ authorization(agent<-->server)anddownload(deletedfromserver) • ▫ TCPPortno.110 • IMAP:InternetMailAccessProtocol • ▫ morefeatures(morecomplex). • ▫ TCPPortno.143 • ▫ Remotemanipulationofstoredmessagesonserver Compiled By: Ashish Kr. Jha

  35. 35 POP3andIMAP AccessProtocolPOP3orIMAP useragent SMTP SMTP user agent receiver’smail server sender’s mail server Compiled By: Ashish Kr. Jha

  36. 36 • POP3(PostOfficeProtocol) • POP3beginswhenuseragentopensaTCPconnectionto • themailserveronport110. • ThenPOP3progressesthrough3phases: • ▫ Authorization:useragentsendsausernameandpassword • toauthenticatetheuser • ▫ Transaction:useragentretrievesmessage,user-agentcanmarkmessagesfordeletion,removedeletionmark • ▫ Update:occursafterclienthasissuedthequitcommand,endingPOP3session,atthistimemailserverdeletethemarkedmessages Compiled By: Ashish Kr. Jha

  37. 37 • POP3 • POP3isextremelysimplemailaccessprotocoland • functionalityislimited. • POP3canbeconfiguredtodownloadanddelete(default • configuration)ordownloadandkeep. • Aproblemwithdownloadanddeletemode–usermaywanttoaccesshismailmessagesformmultiplemachines. • DuringPOP3session,POP3servermaintainssomestateinformationaboutwhichusermessageshavebeenmarkedfordeletion. • However,POP3serverdoesnotcarrystateinformation • acrossPOP3session. Compiled By: Ashish Kr. Jha

  38. 38 POP3 Compiled By: Ashish Kr. Jha

  39. 39 • IMAP(InternetMAP) • Userprefertomaintainafolderhierarchyonremoteserver • thatcanbeaccessedfromanycomputer. • ThisisnotpossiblewithPOP3howeverIMAPprotocolis • definedtosolvetheissue. • IMAPhasmorefeaturealongwithmorecomplexity. • Whenmessagefirstarrives,itisassociated withrecipient’s • INBOXfolder. • Therecipientcanthenmovemessagefromonefolderto • another. • UnlikePOP3,IMAPmaintainsstateinformationacrossIMAPsession,-forexample,namesoffoldersandwhichmessagesareassociatedwithwhichfolders. • IMAPenabletoobtaincomponentsofmessages.(usefulforlowbandwidth). Compiled By: Ashish Kr. Jha

  40. 40 • MIME(MultipurposeInternetMailExtensions) • Electronicmailhasasimplestructure.Itssimplicity,however,comeswithaprice.ItcansendmessagesonlyinNVT(NetworkVirtualTerminal)7-bitASCIIformat.Inotherwords,ithassomelimitations. • MultipurposeInternetMailExtensions(MIME)isasupplementaryprotocolthatallowsnon-ASCIIdatatobesentthroughe-mail.MIMEtransformsnon-ASCIIdataatthesendersitetoNVTASCIIdataanddeliversittotheclientMTAtobesentthroughtheInternet.Themessageatthereceivingsiteistransformedbacktotheoriginaldata. Compiled By: Ashish Kr. Jha

  41. 41 MIME Compiled By: Ashish Kr. Jha

  42. 42 • CommonMIMEtypes • Content-Type:type/subtype;parameters • ▫ Text • plain;html • ▫ Image • jpeg;gif • ▫ Audio • basic;32kadpcm • ▫ Video • quicktime • ▫ Application • msword;octet-stream Compiled By: Ashish Kr. Jha

  43. 43 SecuringEmailUsingPrettyGoodPrivacy(PGP) • prettygoodprivacy(PGP)isane-mailencryptionschemethathasbecomeade-factostandard,withthousandsofusersallovertheglobe. • Dependingontheversion,thePGPsoftwareusesMD5orSHAforcalculatingthemessagedigest;CAST,Triple-DESorIDEAforsymmetrickeyencryption;andRSAforthepublickeyencryption. • Inaddition,PGPprovidesdatacompression. • WhenPGPisinstalled,thesoftwarecreatesapublickeypairfortheuser. • Thepublickeycanbepostedontheuser'sWebsiteorplacedinapublickeyserver. • Theprivatekeyisprotectedbytheuseofapassword.Thepasswordhastobeenteredeverytimetheuseraccessestheprivatekey. • PGPgivestheusertheoptionofdigitallysigningthemessage,encryptingthemessage,orbothdigitallysigningandencrypting. Compiled By: Ashish Kr. Jha

  44. 44 PGP Compiled By: Ashish Kr. Jha

  45. 45 • DNS(DomainNameSystem) • Ahierarchical,distributeddatabasethatcontainsmappingsofDNSdomainnamestovarioustypesofdata,suchasIPaddresses. • DNSenablesthelocationofcomputersandservicesbyuser-friendlynames,anditalsoenablesthediscoveryofotherinformationstoredinthedatabase. • DNSprovidestranslationbetweenhostnameandIPaddress. • DNSnamesareuser-friendly,whichmeansthattheyare • easiertorememberthanIPaddresses. • DNSnamesremainmoreconstantthanIPaddresses.AnIPaddressforaservercanchange,buttheservernameremainsthesame. • DNSallowsuserstoconnecttolocalserversusingthesamenamingconventionastheInternet. • UsesUDPportno.53. Compiled By: Ashish Kr. Jha

  46. 46 Hierarchicalstructureofadomainnamespace Compiled By: Ashish Kr. Jha

  47. 47 • NameServers • RootDomains • ▫ Therootdomainisatthetopofthehierarchyandisrepresentedasaperiod(.). • ▫ TheInternetrootdomainismanagedbyseveral • organizations,includingNetworkSolutions,Inc. • ▫ 13RootNameServers • Top-LevelDomains • ▫ Top-leveldomainsaretwo-orthree-characternamecodes. • ▫ Top-leveldomainsaregroupedbyorganizationtypeorgeographiclocation. • SecondLevelDomains Compiled By: Ashish Kr. Jha

  48. 48 TypesofNameServers rootDNSserver • LocalNameServers • RootNameserver • Authoritativenameserver 2 3 6 7 TLDDNSserver localDNSserver dns.poly.edu 4 5 1 8 authoritativeDNSserver dns.cs.umass.edu requestinghost cis.poly.edu gaia.cs.umass.edu Compiled By: Ashish Kr. Jha

  49. 49 • TypesofNameServers • Top-leveldomain(TLD)servers:responsibleforcom,org, • net,edu,etc,andalltop-levelcountrydomainsuk,fr,ca,jp. • ▫ NetworksolutionsmaintainsserversforcomTLD • ▫ EducationalinstitutionsuseforeduTLD • AuthoritativeDNSservers:organization’sDNSservers, providingauthoritativehostnametoIPmappingsfororganization’sservers(e.g.,Webandmail). • ▫ Canbemaintainedbyorganizationorserviceprovider • LocalDNSservers:Doesnotstrictlybelongtohierarchy • ▫ EachISP(residentialISP,company,university)hasone. • ▫ Also called defaultnameserver • ▫WhenahostmakesaDNSquery,queryissenttoitslocalDNSserver • ▫ Actsasaproxy,forwardsqueryintohierarchy. Compiled By: Ashish Kr. Jha

  50. 50 • DNSServices • HostnametoIPaddresstranslation • Hostaliasing • ▫ Canonical(Real)andaliasnames • Mailserveraliasing • Loaddistribution • ▫ ReplicatedWebservers:setofIPaddressesforonecanonicalname Compiled By: Ashish Kr. Jha

More Related