Distributed Systems 10. Application Layer Simon Razniewski Faculty of Computer Science Free University of Bozen-Bolzano A.Y. 2014/2015.

Slides:



Advertisements
Similar presentations
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
Advertisements

The Application Layer Chapter 7. Electronic Mail Architecture and Services The User Agent Message Formats Message Transfer Final Delivery.
The Internet Useful Definitions and Concepts About the Internet.
Layer 7- Application Layer
Data and Computer Communications Eighth Edition by William Stallings Lecture slides by Lawrie Brown Chapter 23 – Internet Applications Internet Directory.
World Wide Web1 Applications World Wide Web. 2 Introduction What is hypertext model? Use of hypertext in World Wide Web (WWW) – HTML. WWW client-server.
Introduction to Web Interface Technology (CSE2030)
CP476 Internet Computing Browser and Web Server 1 Web Browsers A client software program that allows you to access and view Web pages on the Internet –Examples.
Topics in this presentation: The Web and how it works Difference between Web pages and web sites Web browsers and Web servers HTML purpose and structure.
Application Layer  We will learn about protocols by examining popular application-level protocols  HTTP  FTP  SMTP / POP3 / IMAP  Focus on client-server.
2/9/2004 Web and HTTP February 9, /9/2004 Assignments Due – Reading and Warmup Work on Message of the Day.
Application Layer. Domain Name System Domain Name System (DNS) Problem – Want to go to but don’t know the IP addresswww.google.com Solution.
Introduction 1 Lecture 7 Application Layer (FTP, ) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science & Engineering.
Web Client/Server Communication A290/A590, Fall /09/2014.
Evolved from ARPANET (Advanced Research Projects Agency of the U.S. Department of Defense) Was the first operational packet-switching network Began.
Introduction 1-1 Chapter 2 FTP & Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 IC322 Fall.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011 The Application Layer Chapter
IT 210 The Internet & World Wide Web introduction.
Computer Concepts 2014 Chapter 7 The Web and .
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
1 Application Layer Lecture 5 Imran Ahmed University of Management & Technology.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011 The Application Layer Chapter 7.
SMUCSE 4344 application layer. SMUCSE 4344 application vs. application-layer protocols application-layer protocol is just one piece –how the end hosts.
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 9
Fall 2005 By: H. Veisi Computer networks course Olum-fonoon Babol Chapter 7 The Application Layer.
Chapter 1: Introduction to Web
FTP (File Transfer Protocol) & Telnet
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
2013Dr. Ali Rodan 1 Handout 1 Fundamentals of the Internet.
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
Sistem Jaringan dan Komunikasi Data #9. DNS The Internet Directory Service  the Domain Name Service (DNS) provides mapping between host name & IP address.
Web Engineering we define Web Engineering as follows: 1) Web Engineering is the application of systematic and proven approaches (concepts, methods, techniques,
MySQL and PHP Internet and WWW. Computer Basics A Single Computer.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Chapter.
World Wide Web (WWW) A Distributed Document- Based System Group E Ricky Tong (D-A0-1611) Eddy Leong (D-A0-1623) Dick Lei (D-A0-1658)
1 Welcome to CSC 301 Web Programming Charles Frank.
Application Layer Khondaker Abdullah-Al-Mamun Lecturer, CSE Instructor, CNAP AUST.
CMPE 80N - Introduction to Networks and the Internet 1 Client-Server Architecture Client Server request response.
Web Design (1) Terminology. Coding ‘languages’ (1) HTML - Hypertext Markup Language - describes the content of a web page CSS - Cascading Style Sheets.
INTRODUCTION TO WEB APPLICATION Chapter 1. In this chapter, you will learn about:  The evolution of the Internet  The beginning of the World Wide Web,
ECEN “Internet Protocols and Modeling”, Spring 2012 Course Materials: Papers, Reference Texts: Bertsekas/Gallager, Stuber, Stallings, etc Class.
World Wide Web “WWW”, "Web" or "W3". World Wide Web “WWW”, "Web" or "W3"
CS 3830 Day 9 Introduction 1-1. Announcements r Quiz #2 this Friday r Demo prog1 and prog2 together starting this Wednesday 2: Application Layer 2.
COP 3813 Intro to Internet Computing Prof. Roy Levow Lecture 1.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Application Layer Chapter 7 CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 DNS – Domain Name System Electronic.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
Berkeley Sockets The socket primitives for TCP.. PortProtocol Use 21 FTP File transfer 23 Telnet Remote login 25 SMTP 69 TFTP Trivial File Transfer.
4343 X2 – Outline The Domain Name System The Web.
JavaScript and Ajax (Internet Background) Week 1 Web site:
The Application Layer Chapter Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011.
Ch 2. Application Layer Myungchul Kim
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
Distributed Systems 15. Application Layer Simon Razniewski Faculty of Computer Science Free University of Bozen-Bolzano A.Y. 2015/2016.
Search Engine and Optimization 1. Introduction to Web Search Engines 2.
Spring 2006 CPE : Application Layer_ 1 Special Topics in Computer Engineering Application layer: Some of these Slides are Based on Slides.
CIS 1203 Web Technologies Introduction to the Internet and the WWW.
National College of Science & Information Technology.
The Application Layer DNS – The Domain Name System The DNS Name Space Resource Records Name Servers
4.01 How Web Pages Work.
4.01 How Web Pages Work.
WWW and HTTP King Fahd University of Petroleum & Minerals
Networking CS 3470, Section 1 Sarah Diesburg
Data Communications and Computer Networks Chapter 2 CS 3830 Lecture 9
Protocols and networks in the TCP/IP model initially.
Networking CS 3470, Section 1 Sarah Diesburg
4.01 How Web Pages Work.
Presentation transcript:

Distributed Systems 10. Application Layer Simon Razniewski Faculty of Computer Science Free University of Bozen-Bolzano A.Y. 2014/2015

The Application Layer CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Uses transport services to build distributed applications Physical Link Network Transport Application

Requirements and Constraints Three dimensions for applications Data loss: does the application work even when some data are lost? Bandwidth: does the application fix a (minimum) rate for the information exchange? Timing: does the application accept delays?

Examples ApplicationData lossBandwidthTiming File transfernoelasticno noelasticno Web documentsnoelasticno Real-time audio/video Loss-tolerant Audio: 1Kbps-1Mbps Video: 10Kb+ 100 ms Online gamesLoss-tolerant1 Kbps – 100 Kbps100 ms Financial applicationsnoelasticyes/no

Choosing a Transport Protocol ApplicationA-ProtocolT-ProtocolWhy? File transferFTPTCP Require reliable data transfer services SMTPTCP WebHTTPTCP Remote terminal accessTelnetTCP Streaming multimediaProprietaryUDP or TCP Minimum rate before quality Internet telephonyProprietaryUDP Network managementSNMPUDPMinimally intrusive

Application Layer 1.DNS – Domain Name System 2. 3.The Web …though there are many more…..

DNS – Domain Name System The DNS resolves high-level human readable names for computers to low-level IP addresses DNS name space Domain Resource records Name servers CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

8 Internet Domain Name System (DNS) Design dates back to 1987 (Mockapetris) Before all host names and addresses in one large master file stored on one central host downloaded by computers that needed to resolve names What were the drawbacks of that approach?

9 Internet Domain Name System (cntd) Distributed naming database Hierarchical name structure reflects administrative structure of the Internet Rapidly resolves domain names to IP addresses exploits caching heavily typical query time ~100 milliseconds Scales to millions of computers partitioned database caching Resilient to failure of a server replication (e.g., 13 root servers, 6 servers for.it, etc.)

10 Access to DNS host (linux) command for name resolution and reverse resolution nslookup (windows) command/tool to query DNS servers for arbitrary info dig (linux) similar to nslookup, without some of the deficiencies of the former /etc/resolv.conf (linux) file containing IP address of default name server Java JNDI (= Java Naming and Directory Interface) provides interface for querying DNS => Let’s try

The DNS Name Space (1) DNS namespace is hierarchical from the root down Different parts delegated to different organizations The computer robot.cs.washington.edu

The DNS Name Space (2) Generic top-level domains are controlled by ICANN who appoints registrars to run them CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

Domain Resource Records (1) The key resource records in the namespace are IP addresses (A/AAAA) and name servers (NS), but there are others too (e.g., MX) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

Domain Resource Records (2) A portion of a possible DNS database for cs.vu.nl. IP addresses of computers Name server Mail gateways CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

nslookup unibz.it nslookup -type=mx unibz.it

Name Servers (1) Name servers contain data for portions of the name space called zones (circled). One zone CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

Name Servers (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Finding the IP address for a given hostname is called resolution and is done with the DNS protocol. Resolution: Computer requests local name server to resolve Local name server asks the root name server Root returns the name server for a lower zone Continue down zones until name server can answer DNS protocol: Runs on UDP port 53, retransmits lost messages Caches name server answers for better performance

Wireshark CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 …

Name Servers (3) Example of a computer looking up the IP for a name (recursive lookup) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

20 Name Resolution on the WWW file Web server Socket URL (Ethernet) Network address 2:60:8c:2:b0:5a ARP lookup * /SiteCollectionImages/Headings/Objects/coins.jp Resource ID (IP number, port number, pathname) DNS lookup

Application Layer 1.DNS – Domain Name System 2. 3.The Web

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Architecture and services The user agent Message formats Message transfer Final delivery

Architecture and Services (1) The key components and steps (numbered) to send Architecture of the system e.g. Outlook e.g. Outlook server Outgoing: SMTP Incoming: POP3 (older) IMAP (newer)

Architecture and Services (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Paper mail Electronic mail Envelope, used only for forwarding Message (= header and body)

The User Agent What users see – interface elements of a typical user agent CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

Message Formats (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Header fields related to message transport; headers are readable ASCII text

Message Formats (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Other header fields useful for user agents

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

Message Formats (3) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 MIME (Multi-Purpose Internet Mail Extensions) header fields used to describe what content is in the body of the message

Message Formats (4) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Common MIME content types and subtypes

Message Formats (5) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Putting it all together: a multipart message containing HTML and audio alternatives. One part (HTML) Another (audio)

Message Transfer (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Messages are transferred with SMTP ( Simple Mail Transfer Protocol ) Readable text commands Submission from user agent to MTA on port 587 One MTA to the next MTA on port 25 Other protocols for final delivery (IMAP, POP3)

Message Transfer (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Sending a message: From Alice to Bob SMTP commands are marked [pink]... (rest of message)...

CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 telnet mail1.unibz.it 25 HELO HELP MAIL FROM: RCPT TO: DATA blablabla. QUIT

Final Delivery (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 User agent uses protocol like IMAP for final delivery Has commands to manipulate folders / messages [right] Alternatively, a Web interface (with proprietary protocol) might be used

First recorded occurrence 1864 Term coined by Monty Python in the 1970’s Ways out?

The World Wide Web CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Architectural overview Static Web pages Dynamic pages and Web applications HTTP – HyperText Transfer Protocol

World Wide Web Architectural framework for accessing linked document via the Internet Born to share information among international teams of researchers in particle physics working for CERN (European Center for Nuclear Research) 1989: idea, Tim Berners-Lee 1991: first textual prototype 1993: first graphical browser (Mosaic) 1994: Netscape founded to provide client and servers for the web 1994: CERN and M.I.T. sign an agreement creating the World Wide Web Consortium (W3C) Goal: research, standardization and interoperation for the web : browsers war between Netscape and Microsoft (with Internet Explorer) Then Opera Safari, Firefox, Chrome…

WWW From the Client’s Viewpoint Client = browser The user specifies an URL and gets access to a (web) page that contains text, images, even videos Internet media types for multiple content, + plugins/helper processes for interpreting it Pages are constituted of hypertext They contain special elements (hyperlinks) that point to other pages, possibly hosted to other domains/hosts By following hyperlinks, the user transparently navigates among pages hosted in distant places in the world The idea of hypertext can be traced back to 1945 (M.I.T. professor of electrical engineering, Vannevar Bush)

Architectural Overview (1) HTTP transfers pages from servers to browsers CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011

Architectural Overview (2) Pages are named with URLs (Uniform Resource Locators) Example: CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Our focus Protocol Page on server Server Common URL protocols

Architectural Overview (3) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Steps a client (browser) takes to follow a hyperlink: −Determine the protocol (HTTP) −Ask DNS for the IP address of server −Make a TCP connection to server −Send request for the page; server sends it back −Fetch other URLs as needed to display the page −Close idle TCP connections Steps a server takes to serve pages: −Accept a TCP connection from client −Get page request and map it to a resource (e.g., file name) −Get the resource (e.g., file from disk) −Send contents of the resource to the client. −Release idle TCP connections

Architectural Overview (4) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 To scale performance, Web servers can use: Caching, multiple threads, and a front end

Architectural Overview (5) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Server steps, revisited: Resolve name of Web page requested Perform access control on the Web page Check the cache Fetch requested page from disk or run program Determine the rest of the response Return the response to the client Make an entry in the server log

HTML Page Title This is a Heading This is a paragraph.

Static Web Pages (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Static Web pages are simply files Have the same contents for each viewing Can be visually rich and interactive nonetheless: HTML that mixes text and images Forms that gather user input Style sheets that tailor presentation Vector graphics, videos, and more (over)...

Static Web Pages (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Progression of features through HTML 5.0

HTML Forms How to communicate data from the client to the server? HTML 2.0  forms in the web pages User can fill in the fields, and then “submit” to the server the information GET: as part of a request, in the URL, using ampersands and percent encoding (may be cached) POST: send information separately −advised for sensitive content

Dynamic Pages & Web Applications (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Dynamic pages are generated by programs running at the server (with a database) and the client E.g., PHP at server, JavaScript at client Pages vary each time like using an application

Dynamic Pages & Web Applications (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Web page that gets form input and calls a server program PHP server program that creates a custom Web page Resulting Web page (for inputs “Barbara” and “32”) PHP calls

Dynamic Pages & Web Applications (3) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 JavaScript program produces result page in the browser First page with form, gets input and calls program above

Dynamic Pages & Web Applications (4) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 The difference between server and client programs Server-side scripting with PHP Client-side scripting with JavaScript

Dynamic Pages & Web Applications (5) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Web applications use a set of technologies that work together, e.g. AJAX: HTML: present information as pages. DOM: change parts of pages while they are viewed. XML: let programs exchange data with the server. Asynchronous way to send and retrieve XML data. JavaScript as a language to bind all this together.

Dynamic Pages & Web Applications (6) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 The DOM (Document Object Model) tree represents Web pages as a structure that programs can alter

Dynamic Pages & Web Applications (7) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 XML captures data, not presentation like HTML. Ex:

Dynamic Pages & Web Applications (8) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Web applications use a set of technologies, revisited:

The Overall Model

HTTP (1) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 HTTP (HyperText Transfer Protocol) is a request- response protocol that runs on top of TCP Fetches pages from server to client Server usually runs on port 80 Headers are given in readable ASCII Content is described with MIME types Protocol has support for pipelining requests Protocol has support for caching

HTTP (2) HTTP uses persistent connections to improve performance CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 One connection for each request Sequential requests on one connection Pipelined requests on one connection

HTTP (3) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 HTTP has several request methods. Fetch a page Used to send input data to a server program

HTTP (4) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Response codes tell the client how the request fared:

HTTP (5) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Many headers carry key information: FunctionExample Headers Browser capabilities (client  server) User-Agent, Accept, Accept-Charset, Accept- Encoding, Accept-Language Caching related (mixed directions) If-Modified-Since, If-None-Match, Date, Last- Modified, Expires, Cache-Control, ETag Browser context (client  server) Cookie, Referer, Authorization, Host Content delivery (server  client) Content-Encoding, Content-Length, Content-Type, Content-Language, Content-Range, Set-Cookie

HTTP (6) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 HTTP caching checks to see if the browser has a known fresh copy, and if not if the server has updated the page Uses a collection of headers for the checks Can include further levels of caching (e.g., proxy)

HTTP Message Format Not only requests for pages are supported by HTTP In general, HTTP supports different requests and corresponding responses You can take a look at HTTP messages by using telnet telnet 80 … GET /inf/ HTTP/1.0 => Let’s try

Stateless vs Stateful HTTP is a stateless protocol Good for performance and for the original intention of the web (accessing documents) Now the web is used for many other needs E-commerce, access, financial transactions, … These uses typically require to keep a “state” of the interaction User authentication, user cart, … State using IP address  not ideal

Cookies HTTP server response may contain a small amount (<4K) of information (cookie) Cookies are locally stored by the client It is possible to disable this behavior Each cookie contains Domain: which domain can use the cookie (browsers can check that server is not cheating) Path: which parts of the server’s tree can use the cookie (typically /  the whole tree) Content: key=value(s) pairs Expires −if absent  cookie non-persisting (discarded by the browser when it exits) −if provided  determines the expiration date of the persistent cookie Secure: if yes, the cookie can be returned only to a secure server

Cookies (2) CN5E by Tanenbaum & Wetherall, © Pearson Education-Prentice Hall and D. Wetherall, 2011 Examples of cookies

Use of Cookie When the client asks a certain URL, it checks if there are cookies that correspond to it In this case, they are attached as part of the HTTP request header The server can interprets the received cookies to change its behavior E.g., show the content of the user’s cart if there is a cart cookie whose values contain the identifiers of the chosen items Web tracking… => Try to catch some cookies in the lab!

Take home DNS built upon UDP recursive resolution HTTP Build upon TCP Cookies Caching HTML Markup language for static webpages