1 / 20

Module 2.1: Application Layer

Module 2.1: Application Layer. Application-level protocols provide high-level services Web and HTTP DNS Electronic mail Remote login FTP telnet SNMP Multimedia - VoIP All of these applications use client-server architecture. World Wide Web. Hypertext model (HTML)

Télécharger la présentation

Module 2.1: Application Layer

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. Module 2.1: Application Layer • Application-level protocols provide high-level services • Web and HTTP • DNS • Electronic mail • Remote login • FTP • telnet • SNMP • Multimedia - VoIP • All of these applications use client-server architecture K. Salah

  2. World Wide Web • Hypertext model (HTML) • Use of hypertext in World Wide Web (WWW) • WWW client-server model • Use of TCP/IP protocols in WWW • Nice tutorials on HTML and HTTP can be found on course web source in resources section. K. Salah

  3. Identifying a page • Page identified by: • Protocol used to access page • Computer on which page is stored • TCP port to access page • Pathname of file on server • Specific syntax for Uniform Resource Locator (URL): protocol://computer_name:port/document_name • Protocol can be http, ftp, file, mailto • Computer name is DNS name • (Optional) port is TCP port • document_name is path on computer to page K. Salah

  4. Client Architecture • Browser has the following components: • Display driver for painting screen • HTML interpreter for HTML-formatted documents • Other interpreters (e.g., Shockwave, JVM, VB runtime environment) for other items • HTTP client to fetch HTML documents from WWW server • Other clients for other protocols (e.g., ftp, telnet) • Controller to accept input from user • Must be multi-threaded K. Salah

  5. HTTP: hypertext transfer protocol Web’s application layer protocol client/server model client: browser that requests, receives, “displays” Web objects server: Web server sends objects in response to requests HTTP 1.0: RFC 1945 HTTP 1.1: RFC 2068 HTTP overview HTTP request PC running Explorer HTTP response HTTP request Server running Apache Web server HTTP response Mac running Navigator K. Salah

  6. Uses TCP (socket programming): Server listens on port 80 or 8080 for accepting connections from client client initiates TCP connection (creates socket) to server, port 80 server accepts TCP connection from client, and creates thread to handle accepted connection Connection is established now between client and server thread HTTP messages between Client and Server are exchanged TCP connection closed Meanwhile server keeps listening for new connections HTTP is “stateless” server maintains no information about past client requests, as each request is process independently, without knowledge of the old requests. Server does not know who the client is? Or is it? HTTP overview (continued) aside • We will illustrate this further in TCP layer. K. Salah

  7. Sample HTTP1.0 Exchange • To retrieve the file at the URL http://www.somehost.com/path/file.html • first open a socket to the host www.somehost.com, port 80 (use the default port of 80 because none is specified in the URL). Then, send something like the following through the socket: • GET /path/file.html HTTP/1.0 • From: someuser@jmarshall.com • User-Agent: HTTPTool/1.0 • [blank line here] • The server should respond with something like the following, sent back through the same socket: • HTTP/1.0 200 OK • Date: Fri, 31 Dec 1999 23:59:59 GMT • Content-Type: text/html Content-Length: 1354 • <html> • <body> • <h1>Happy New Millennium!</h1> • (more file contents) • . • . • </body> • </html> • After sending the response, the server closes the socket  servicing only one request per connection. K. Salah

  8. HTTP request message: general format K. Salah

  9. HTTP request message • two types of HTTP messages: request, response • HTTP request message: • ASCII (human-readable format) request line (GET, POST, HEAD commands) GET /somedir/page.html HTTP/1.1 Host: www.someschool.edu User-agent: Mozilla/4.0 Connection: close Accept-language:fr (extra carriage return, line feed) header lines Carriage return, line feed indicates end of message K. Salah

  10. HTTP response message status line (protocol status code status phrase) HTTP/1.1 200 OK Connection close Date: Thu, 06 Aug 1998 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 1998 …... Content-Length: 6821 Content-Type: text/html data data data data data ... header lines data, e.g., requested HTML file K. Salah

  11. Nonpersistent HTTP At most one object is sent over a TCP connection. HTTP/1.0 uses nonpersistent HTTP Persistent HTTP Multiple objects can be sent over single TCP connection between client and server. HTTP/1.1 uses persistent connections in default mode with pipelining. Without pipelining client has to issue one request at a time. It can not issue a new request until it receives the response of the previous one. With pipelining client doesn’t have to wait for first response. Client can request multiple objects. HTTP connections What is? • HTTP Transaction • HTTP request and response • HTTP Hit • For server statistics • Server sends one object to client K. Salah

  12. HTTP 1.1 and higher • As of early 1997, the Web is moving from HTTP 1.0 to HTTP 1.1. Whenever practical, use HTTP 1.1. It's more efficient overall. WHY? • HTTP1.0 Client Request telnet www.ccse.kfupm.edu.sa80 GET http://www.ccse.kfupm.edu.sa/~salah/ics432/index.html • HTTP1.1 Client Request telnet www.ccse.kfupm.edu.sa 80 GET http://www.ccse.kfupm.edu.sa/~salah/ics432/index.html HTTP/1.1 Host: www.ccse.kfupm.edu.sa:80 • HTTP1.2 Client Request telnet www.ccse.kfupm.edu.sa 80 GET http://www.ccse.kfupm.edu.sa/~salah/ics432/index.html HTTP/1.2 No need to have Host: field for every request. K. Salah

  13. Post method: Web page often includes form input Input is uploaded to server in entity body URL method: Uses GET method Input is uploaded in URL field of request line: Uploading form input www.somesite.com/animalsearch?monkeys&banana K. Salah

  14. HTTP/1.0 GET POST HEAD asks server to leave requested object out of the response. Headers is only sent. Used for debugging. HTTP/1.1 GET, POST, HEAD PUT uploads file in entity body to path specified in URL field DELETE deletes file specified in the URL field Method types K. Salah

  15. Many major Web sites use cookies Four components: 1) cookie header line in the HTTP response message 2) cookie header line in HTTP request message 3) cookie file kept on user’s host and managed by user’s browser 4) back-end database at Web site Example: Susan access Internet always from same PC She visits a specific e-commerce site for first time When initial HTTP requests arrives at site, site creates a unique ID and creates an entry in backend database for ID Cookies: keeping “state” K. Salah

  16. client server usual http request msg usual http response + Set-cookie: 1678 Cookie file Cookie file Cookie file amazon: 1678 ebay: 8734 amazon: 1678 ebay: 8734 ebay: 8734 cookie- specific action usual http request msg cookie: 1678 usual http request msg cookie: 1678 usual http response msg usual http response msg cookie- spectific action Cookies: keeping “state” (cont.) Amazon server creates ID 1678 for user entry in backend database access access one week later: K. Salah

  17. What cookies can bring: authorization shopping carts recommendations user session state (Web e-mail) Cookies (continued) aside Cookies and privacy: • cookies permit sites to learn a lot about you • you may supply name and e-mail to sites • search engines use redirection & cookies to learn yet more • advertising companies obtain info across sites K. Salah

  18. user sets browser: Web accesses via cache browser sends all HTTP requests to cache object in cache: cache returns object else cache requests object from origin server, then returns object to client Web caches (proxy server) Goal: satisfy client request without involving origin server origin server Proxy server HTTP request HTTP request client HTTP response HTTP response HTTP request HTTP response client • Web proxies can be multipurpose: • cache, • Firewall • Monitor and log activites • NAT origin server K. Salah

  19. Local cache can be used to hold copies of visited pages Cache acts as both client and server Cache can do up-to-date check using If-modified-since HTTP header HTTP response messages has Age header. Specifies how long the info is valid for. Typically cache is installed by ISP (university, company, residential ISP) Why Web caching? Reduce response time for client request. Downloading HTML documents from servers may be slow Internet congested Dialup connection Server busy Reduce traffic on an institution’s access link. More about Web caching K. Salah

  20. Goal: don’t send object if client has up-to-date cached version client: specify date of cached copy in HTTP request If-modified-since: <date> server: response contains no object if cached copy is up-to-date: HTTP/1.0 304 Not Modified HTTP response HTTP/1.0 304 Not Modified Conditional GET: client-side caching server client HTTP request msg If-modified-since: <date> object not modified HTTP request msg If-modified-since: <date> object modified This is basically what happens when you hit “Refresh” or “update” button on the browser, I.e. GET with If-modified-sinceof current date. HTTP response HTTP/1.0 200 OK <data> K. Salah

More Related