15 213
play

15-213 The course that gives CMU its Zip! Web Services Web - PowerPoint PPT Presentation

15-213 The course that gives CMU its Zip! Web Services Web Services Nov 26, 2002 Nov 26, 2002 Topics Topics HTTP Serving static content Serving dynamic content


  1. � � � 15-213 “The course that gives CMU its Zip!” Web Services Web Services Nov 26, 2002 Nov 26, 2002 Topics Topics HTTP Serving static content Serving dynamic content ✁✄✂✄☎✝✆✄✆✟✞✝✠☛✡✌☞✍☞☛✎

  2. � � � Web History Web History 1945: 1945: 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: 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: 1990: Tim BL writes a graphical browser for Next machines. 15-213, F’02 – 2 –

  3. � � � � � � � Web History (cont) Web History (cont) 1992 1992 NCSA server released 26 WWW servers worldwide 1993 1993 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 1994 Andreessen and colleagues leave NCSA to form "Mosaic Communications Corp" (now Netscape). 15-213, F’02 – 3 –

  4. Internet Hosts Internet Hosts 15-213, F’02 – 4 –

  5. ★ ★ ★ ★ ★ Web Servers Web Servers Clients and servers Clients and servers communicate using the communicate using the HyperText Transfer Transfer HyperText ✏✒✑✓✑✓✔ ✕☛✖✓✗✓✘✓✖✒✙✓✚ Protocol (HTTP) Protocol (HTTP) Client and server Web Web establish TCP connection client server (browser) Client requests content ✏✒✑✓✑✓✔ ✕☛✖✒✙✝✛✢✜☛✣✒✙☛✖ Server responds with ✤✦✥ ✜☛✣✒✚☛✖✓✣✒✚✒✧ requested content Client and server close connection (usually) Current version is HTTP/1.1 Current version is HTTP/1.1 RFC 2616, June, 1999. 15-213, F’02 – 5 –

  6. � � � � � � Web Content Web Content Web servers return content content to clients to clients Web servers return content: a sequence of bytes with an associated MIME (Multipurpose Internet Mail Extensions) type Example MIME types Example MIME types ✩✫✪✭✬✮✩✰✯✲✱✮✩✴✳✮✵ HTML document ✩✫✪✭✬✮✩✰✯✲✶✷✵✰✸✰✹✫✺ Unformatted text ✸✫✶✰✶✷✵✰✹✰✻✰✸✷✩✫✹✰✼✽✺✮✯✲✶✷✼✷✾✰✩✰✾✫✻✰✿✰✹✫✶❀✩ Postcript document ✹✲✳❁✸✰❂✰✪✷✯✫❂✰✹✷❃ Binary image encoded in GIF format ✹✲✳❁✸✰❂✰✪✷✯✰❄✲✶✷✪✰❂ Binary image encoded in JPEG format 15-213, F’02 – 6 –

  7. � � Static and Dynamic Content Static and Dynamic Content The content returned in HTTP responses can be either The content returned in HTTP responses can be either static or or dynamic dynamic . . static Static content: content stored in files and retrieved in response to an HTTP request Examples: HTML files, images, audio clips. Dynamic content: content produced on-the-fly in response to an HTTP request Example: content produced by a program executed by the server on behalf of the client. Bottom line: All Web content is associated with a file All Web content is associated with a file Bottom line: that is managed by the server. that is managed by the server. 15-213, F’02 – 7 –

  8. ▲ ✥ ❖ � ❛ ❖ ✥ ✥ � � � ✥ URLs URLs Each file managed by a server has a unique name called a Each file managed by a server has a unique name called a URL (Universal Resource Locator) URL (Universal Resource Locator) URLs for static content: URLs for static content: ✱✮✩✰✩✲✶ ❅✴✯❆✯✲❇✰❇✰❇ ❈❉✻✷✾❊❈❉✻✲✳✷❋ ❈❉✪✰●✫❋ ❅✴❍✰■✰✯✫✹✫✺✷●✰✪✫✬ ❈❏✱✮✩✴✳✮✵ ✱✮✩✰✩✲✶ ❅❑✯✰✯✲❇✰❇✰❇ ❈❉✻✷✾❊❈❉✻✲✳✷❋ ❈❉✪✰●✫❋✮✯✫✹✫✺✷●✰✪✫✬ ❈❏✱✮✩✴✳✮✵ ✱✮✩✰✩✲✶ ❅✴✯✰✯✲❇✰❇✰❇ ❈❉✻✷✾❊❈❉✻✲✳✷❋ ❈❉✪✰●✫❋ ✣✓▼✓✖✓◆P❖✦◗✒✚✝❘✢❙❯❚ managed by a Web server at Identifies a file called ✙❲❖ ❘✒✘❳❖✦✖✓▼✓✘ that is listening on port 80. ❱✓❱✓❱ URLs for dynamic content: URLs for dynamic content: ✱✮✩✰✩✲✶ ❅✴✯✰✯✲❇✰❇✰❇ ❈❉✻✷✾❊❈❉✻✲✳✷❋ ❈❉✪✰●✫❋ ❅✴❍✰■✰■✰■✰✯✫✻✰❂✰✹✷❨✴❩✮✹✫✺✮✯✫✸✰●✰●✰✪✰✿✷❬✰❭✫❪✷■✰■✰■✰❫✫❴✷❭✫❵ ▼✓▼✓✖✒✕ , managed by a Web Identifies an executable file called ✙❁❖ ❘✒✘❜❖✦✖✓▼✓✘ that is listening on port 8000, that ❱✓❱✓❱ server at should be called with two argument strings: ❝✓❞✓❡✓❡✓❡ and ❢✓❝✓❣ . 15-213, F’02 – 8 –

  9. � � ✣ � � � How Clients and Servers Use URLs How Clients and Servers Use URLs Example URL: Example URL: Clients use prefix prefix ( ( ) to infer: Clients use ) to infer: What kind of server to contact (Web server) ❈❉✻✰✼✲✳ ) ❇✰❇✰❇ ❈❉✸✰✼✰✵ Where the server is ( What port it is listening on (80) Servers use suffix suffix ( ( ) to: Servers use ) to: Determine if request is for static or dynamic content. No hard and fast rules for this. ✥☛❤ Convention: executables reside in ▲❥✐✄❦✢▲ directory Find file on file system. Initial “ ❧ ” in suffix denotes home directory for requested content. Minimal suffix is “ ❧ ”, which all servers expand to some default ✣✓▼✓✖✓◆P❖✦◗✒✚✝❘✢❙ ). home page (e.g., ▲ 15-213, F’02 – 9 –

  10. ➓ ➢ ➅ ➥ ❸ ➵ ➄ ❷ ♥ ➉ ➏ ➅ ➄ ➄ ➜ ➍ ➉ ➠ ➄ ♦ ➅ ➳ ❷ ❽ ➄ ➞ ➲ q ➲ ➔ ➅ q ➅ ➍ ♥ ↔ ➆ ➅ ➍ ➅ ➥ ♦ ➦ ➉ ➧ ➔ ➎ ➓ ➄ ➍ ➉ ❽ ❷ ➔ ➉ ➅ ➆ ➏ ❷ ♦ ➍ ❽ ➄ ➇ Anatomy of an HTTP Transaction Anatomy of an HTTP Transaction ♠✴♥✲♦❉♣rq s❉t✴✉❉✈✲t✲s ✇✴✇✴✇✰①③②✴④✴✉⑤①⑦⑥✴④❏⑧ ⑨✴⑩ Client: open connection to server ❶✲❷❉❸ ♦❉♥✴❹ ❺✴❻✴❼✰❽⑦❾✴❿✴❿✰❽⑦❾✴➀✲➁✫❽⑦❺✴➂✰❽r❽✴❽ Telnet prints 3 lines to the terminal ➃✴➄ ➉✴➄✲➊ ➄❉➋ ♥✴♥✴➅✲➆✴➇❉➅r➈ ❽⑦➆ ➉❉➎ ➌✲➍ ➐⑦➑✲➒✫➐ ➆❉➏ ➆✴➇❉➅ ➌✴❶ →✴❶✴❶✲➣✴➔ ❾✰❽⑦❾ Client: request line ➉✴➄✲➊ ➄❉➋ ➇✰↔ ↕✴↕✴↕✮❽ ❽⑦➆ Client: required HTTP/1.1 HOST header Client: empty line terminates headers →✴❶✴❶✲➣✴➔ ❾✰❽⑦❻ ❺✴❻✴❻ ➙✴➛ ➜✫➝❏➜✲➌✲➞❏➟ ❷✴➍ ♥✷↔ ❾✰❽⑦❻ Server: followed by five response headers ➜❥❶ ➇❉➅✷↔ ♥✷➡ ❻✴❿ ❺✴❻✴❻✴❾ ❻✴➀✰↔⑦❼✲➤✫↔⑦➀✴❺ ❷❉➦ ❷❉➦ ❷➨➔ ❷❉➦ ❷➨➔ ❺✰❽⑦❻ ➩✲➙✴➫ ❺✰❽⑦➂✰❽⑦➂ ➃✴➄ ➋✽➊ ➞❉❶✴❸ ♥✲➇❉➅✴♥✲➇ ➅✷↔ ➇❉➅✴♣✲➇ ➏✲➇ Server: expect HTML in the response body ➃✴➄ ♥✲➇❉➅✴♥✲➇ ➫✴➅✴♥✴❹✲➇❉➏✷↔ ➀✴❺✴❻✲➤❉❺ Server: expect 42,092 bytes in the resp body ✈ ”) terminates hdrs ➭⑦➯✰➭ Server: empty line (“ ➋✫➊ ➏✲➇ Server: first HTML line in response body ❽✴❽✴❽ Server: 766 lines of HTML not shown. ➋✫➊ ➏✲➇ Server: last HTML line in response body ➃✴➄ ➊❉➄ ♥✴♥✴➅✲➆✴➇✴♦ ➅✴➈ ➅✲♦❉❹✴♥ ➇✰❽ Server: closes connection ♠✴♥✲♦❉♣✴q Client: closes connection and terminates 15-213, F’02 – 10 –

  11. ❈ � ➘ ➘ ➘ ➘ ➘ ➘ � � HTTP Requests HTTP Requests HTTP request is a request line request line , followed by zero or , followed by zero or HTTP request is a more request headers request headers more Request line: Request line: ➸✷➺✷✪✰✿➻✾✫✹✰✼✫✺➻➼ is HTTP version of request ( ✯⑤❭❊❈✴■ or ➽✷➾✰➾✰➚ ✯✰❭❊❈✴❭ ) ➽➪➾✰➾✰➚ ➸✷❋✷✿⑤✹✰➼ is typically URL for proxies, URL suffix for servers. ➸✰✳✮✪➻✩✲✱✷✼⑤●✰➼ is either ➶✽➹✷➾ ➚✫➴➻➷✰➾ ➴✷➚⑤➾✷➬✲➴✰➮➻➷ ➽✰➹✫➱➻✃ ➚✫❐✷➾ or ✃✰➹✷❒✫➹➻➾✫➹ ➾✽❮✫➱✮❰✽➹ 15-213, F’02 – 11 –

Recommend


More recommend