1 / 35

Understanding HTTP Protocol Layers & Communication

Explore popular application-level protocols like HTTP, FTP, SMTP, POP3, IMAP. Delve into HTTP overview, connections, non-persistent & persistent versions, message formats, and response statuses. Enhance knowledge on URL structures and server-client interactions in the HTTP protocol.

beatrizm
Download Presentation

Understanding HTTP Protocol Layers & Communication

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. Lecture 5Internet Core: Protocol layers

  2. Application Layer We will learn about protocols by examining popular application-level protocols HTTP FTP SMTP / POP3 / IMAP Focus on client-server model Web HTML application transport network data link physical application transport network data link physical application transport network data link physical Lecture 5

  3. Web and HTTP First some jargon What is WWW? Web page consists of objects Objects can be HTML file, JPEG image, JavaScript, video file,… Web page consists of base HTML-file which includes several referenced objects Each object is addressable by a URL Example URL: www.someschool.edu/someDept/pic.jpg path name host name Lecture 5

  4. HTTP overview HTTP: hypertext transfer protocol Web’s application layer protocol Resources to be accessed by HTTP are identified using Uniform Resource Identifiers (URIs)—or, more specifically, Uniform Resource Locators (URLs) HTTP request PC running Explorer HTTP response HTTP request Server running Apache Web server HTTP response Mac running Navigator Lecture 5

  5. HTTP overview (continued) HTTP requires guarantee: HTTP (app.) runs over TCP (transport) client initiates TCP connection (creates socket) to server, port 80 server accepts TCP connection from client HTTP messages (application-layer protocol messages) exchanged between browser (HTTP client) and Web server (HTTP server) TCP connection closed Lecture 5

  6. HTTP connections Nonpersistent HTTP At most one object is sent over a TCP connection. Persistent HTTP Multiple objects can be sent over single TCP connection between client and server. Lecture 5

  7. Nonpersistent HTTP Suppose user enters URL www.someSchool.edu/someDepartment/home.index 1a. HTTP client initiates TCP connection to HTTP server (process) at www.someSchool.edu on port 80 (contains text, references to 10 jpeg images) 1b. HTTP server at host www.someSchool.edu waiting for TCP connection at port 80. “accepts” connection, notifying client 2. HTTP client sends HTTP request message (containing URL) into TCP connection socket. Message indicates that client wants object someDepartment/home.index 3. HTTP server receives request message, forms response message containing requested object, and sends message into its socket time Lecture 5

  8. Nonpersistent HTTP (cont.) 5. HTTP client receives response message containing html file, displays html. Parsing html file, finds 10 referenced jpeg objects 4. HTTP server closes TCP connection. time 6.Steps 1-5 repeated for each of 10 jpeg objects Lecture 5

  9. Non-Persistent HTTP: Response time Definition of RTT: time for a small packet to travel from client to server and back. Response time: one RTT to initiate TCP connection one RTT for HTTP request and first few bytes of HTTP response to return file transmission time total = 2RTT+transmit time initiate TCP connection RTT request file time to transmit file RTT file received time time Lecture 5

  10. Persistent HTTP Nonpersistent HTTP issues: requires 2 RTTs per object OS overhead for each TCP connection Improved version: browsers often open parallel TCP connections to fetch referenced objects Persistent HTTP server leaves connection open after sending response subsequent HTTP messages between same client/server sent over open connection client sends requests as soon as it encounters a referenced object as little as one RTT for all the referenced objects Lecture 5

  11. HTTP Message Format • 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 Lecture 5

  12. HTTP request message: general format Lecture 5

  13. Request Method types GET Requests a representation of the specific resource. POST Submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request. This may result in the creation of a new resource or the updates of existing resources or both. PUT Uploads a representation of the specific resource. DELETE Deletes the specific resource. TRACE Echoes back the received request, so that a client can see what intermediate servers are adding or changing in the request. Lecture 5 1-13

  14. 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 Lecture 5

  15. 200 OK request succeeded, requested object later in this message 301 Moved Permanently requested object moved, new location specified later in this message (Location:) 400 Bad Request request message not understood by server 404 Not Found requested document not found on this server 505 HTTP Version Not Supported HTTP response status codes In first line in server->client response message. A few sample codes: Lecture 5

  16. HTTP overview (continued) If HTTP is “stateless”, how does it remember our session information? HTTP Cookies HTTP is “stateless” • server maintains no information about past client requests Lecture 5

  17. User-server state: cookies Many major Web sites use cookies 1) cookie file kept on user’s host, managed by user’s browser 2) back-end database at Web site Cookies are not cache! Example: When initial HTTP requests arrives at site, site creates: unique ID entry in backend database for ID Lecture 5

  18. Cookies: keeping “state” (cont.) usual http request msg Amazon server creates ID 1678 for user usual http response Set-cookie: 1678 create entry amazon 1678 amazon 1678 usual http request msg cookie: 1678 access cookie- specific action usual http response msg usual http response msg access usual http request msg cookie: 1678 cookie- spectific action client server cookie file backend database one week later: Lecture 5

  19. Cookies (continued) What cookies can bring: Authorization Previous session (e.g., shopping carts) Remember HTTP is “stateless” aside Cookies and privacy: • cookies permit sites to learn a lot about you!!! • Security??? Lecture 5

  20. Category of cookies First party cookies Same domain Third party cookies Different domain than what is being shown Mostly used for tracking users browsing websites (spyware) Cookies are not malwares but they can violate privacy rules Lecture 5

  21. How to speed up Internet access? An example: average object size = 100,000 bits avg. request rate from institution’s browsers to origin servers = 15/sec Internet delay from institutional router to any origin server and back to router = 2 sec Consequences utilization on LAN = 15% utilization on access link = 100% total delay = Internet delay + access delay + LAN delay = 2 sec + seconds + milliseconds Huge delay origin servers public Internet 1.5 Mbps access link institutional network 10 Mbps LAN Lecture 5

  22. How to speed up Internet access? (cont) possible upgrade increase bandwidth of access link to, say, 10 Mbps consequence utilization on LAN = 15% utilization on access link = 15% Total delay = Internet delay + access delay + LAN delay = 2 sec + msecs + msecs often a costly upgrade origin servers public Internet 10 Mbps access link institutional network 10 Mbps LAN Lecture 5

  23. A better solution: Web Cache Install web cache suppose hit rate is 0.4 consequence 40% requests will be satisfied almost immediately 60% requests satisfied by origin server utilization of access link reduced to 60%, resulting in negligible delays origin servers public Internet 1.5 Mbps access link institutional network 10 Mbps LAN institutional cache Lecture 5

  24. Web caches (proxy server) 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 HTTP request HTTP request HTTP response HTTP response HTTP request HTTP response Goal: satisfy client request without involving origin server origin server Proxy server client client origin server Lecture 5

  25. More about Web caching Why Web caching? reduce response time for client request reduce traffic on an institution’s access link. Internet dense with caches: enables “poor” content providers to effectively deliver content HTTP request HTTP request HTTP response HTTP response HTTP request HTTP response origin server Proxy server client client origin server Lecture 5

  26. Application layer 2.1 Web browsing and HTTP 2.2 File transferring and FTP (File Transfer Protocol) 2.3 Email and SMTP Lecture 5

  27. FTP: the file transfer protocol transfer file to/from remote host client/server model client: side that initiates transfer (either to/from remote) server: remote host ftp server: port 21 FTP user interface FTP client FTP server file transfer user at host remote file system local file system Lecture 5

  28. FTP: separate control, data connections FTP client contacts FTP server at port 21 client authorized over control connection client browses remote directory by sending commands over control connection. when server receives file transfer command, server opens 2ndTCP connection (for file) to client after transferring one file, server closes data connection. TCP control connection port 21 TCP data connection port 20 FTP client FTP server Lecture 5

  29. Application layer 2.1 Web browsing and HTTP 2.2 File transferring and FTP 2.3 Email and SMTP (Simple Mail Transfer Protocol) Lecture 5

  30. Three major components: user agents mail servers simple mail transfer protocol: SMTP User Agent a.k.a. “mail reader” composing, editing, reading mail messages e.g., Outlook, Mozilla Thunderbird outgoing, incoming messages stored on server user agent user agent user agent user agent user agent user agent SMTP SMTP SMTP mail server mail server mail server outgoing message queue user mailbox Electronic Mail Lecture 5

  31. Mail Servers mailbox contains incoming messages for user messagequeue of outgoing (to be sent) mail messages SMTP protocol between mail servers to send email messages client: sending mail server “server”: receiving mail server user agent user agent user agent user agent user agent user agent SMTP SMTP SMTP mail server mail server mail server Electronic Mail: mail servers Lecture 5

  32. 1) Alice uses UA to compose message and “to” bob@someschool.edu 2) Alice’s UA sends message to her mail server; 3) Message placed in message queue 4) Client side of SMTP opens TCP connection with Bob’s mail server and sends Alice’s message 5) Bob’s mail server places the message in Bob’s mailbox 6) Bob invokes his user agent to read message user agent user agent mail server mail server Scenario: Alice sends message to Bob 1 2 6 3 4 5 Lecture 5

  33. SMTP uses persistent connections Comparison with HTTP: HTTP: pull SMTP: push HTTP: port 80 SMTP: port 25 Both require guarantee Both use TCP connection SMTP: comparison with HTTP Lecture 5

  34. user agent user agent sender’s mail server SMTP Mail access protocols SMTP access protocol receiver’s mail server • Post Office Protocol (POP3) • Internet Message Access Protocol (IMAP) Lecture 5

  35. POP3 Uses “download and delete” mode. Bob cannot re-read e-mail if he changes client POP3 is “stateless” across sessions IMAP Keep all messages in one place: the server Allows user to organize messages in folders IMAP keeps user state across sessions: names of folders and mappings between message IDs and folder name POP3 and IMAP: Comparison Lecture 5

More Related