Download presentation
Presentation is loading. Please wait.
1
Chapter 9 More on HTTP and DNS Professor Rick Han University of Colorado at Boulder rhan@cs.colorado.edu
2
Prof. Rick Han, University of Colorado at Boulder Announcements HW #4 due April 16 Programming Assignment #3 Thursday Midterm solutions on Web Lecture slides from last week on the Web Next, more on HTTP and DNS, also SMTP
3
Prof. Rick Han, University of Colorado at Boulder Recap of Previous Lecture HTTP A Simple Stateless Request-Response Protocol Simplicity leads to poor interaction with TCP Persistent HTTP 1.1 multiplexes multiple HTTP requests onto a single TCP connection Caching Proxies Reduce client response time Reduce wide-area network traffic Reduce server processing Combining Caching and Prefetching
4
Prof. Rick Han, University of Colorado at Boulder More on HTTP Configure the Web browser to access the Web via the HTTP proxy: Internet Explorer: Tools Internet Options Connections LAN Settings Netscape: Edit Preferences Advanced Proxies Manual DNS lookup by HTTP Proxy Given URL http://www.cs.colorado.edu/index.html, then proxy must call DNS to translate www.cs.colorado.edu to 128.138.242.195 Then, proxy establishes HTTP over TCP connection to 128.138.242.195 to retrieve URL’s page
5
Prof. Rick Han, University of Colorado at Boulder More on HTTP (2) Most browsers now support HTTP 1.1 Compatibility with HTTP 1.0 is “expected” but not mandated Eased via HTTP proxies Load balancing via HTTP Redirect In response to a GET request, a server can return an HTTP Redirect Response Server selects another server that is less loaded Client is redirected to again send GET request to less loaded server GET (1) Redirect (2) GET (3) HTTP Server 1 HTTP Server 2 Client
6
Prof. Rick Han, University of Colorado at Boulder More on HTTP (3) GET: Retrieve document, No payload One-step roundtrip process Incorporate parameters via long URL The server returns a response file with a MIME header identifying the type of file. MIME was developed for email, but is reused by HTTP POST: sent from Client to Server typically used by HTML to send data to a back-end CGI script Two-roundtrip process: contact form-processing server, then send data Give information to a server, has payload Expect a response
7
Prof. Rick Han, University of Colorado at Boulder More on HTTP (4) POST vs. GET Use POST instead of GET if you want to send complex long text fields/parameters to server PUT: sent from Client to Server Store document at server under specified URL, May be disabled at server to avoid modifying files Receive a response: Created, Modified, … POST vs. PUT POST URL specifies the CGI process that will handle the enclosed form PUT URL specifies the enclosed document to be created/stored
8
Prof. Rick Han, University of Colorado at Boulder DNS Lookup Example Client Local DNS server root & edu DNS server cmu.edu DNS server www.cs.cmu.edu NS cmu.edu www.cs.cmu.edu NS cs.cmu.edu www=IPaddr cs.cmu.edu Authoritative DNS server Courtesy: Srini Seshan
9
Prof. Rick Han, University of Colorado at Boulder More on DNS In addition to name translation, DNS helps with Host aliasing DNS supports multiple host names for a single IP address, e.g. yahoo.com and www.yahoo.com Load distribution Instead of HTTP Redirect, use DNS! A busy site like cnn.com will have multiple replicated Web servers, each with a different IP address A set of IP addresses associated with cnn.com DNS can return multiple records that match a single name Order of replicated server addresses is rotated
10
Prof. Rick Han, University of Colorado at Boulder DNS Message Format Identification No. of Questions No. of Authority RRs Questions (variable number of answers) Answers (variable number of resource records) Authority (variable number of resource records) Additional Info (variable number of resource records Flags No. of Answer RRs No. of Additional RRs Name, type fields for a query RRs in response to query Records for authoritative servers Additional “helpful info that may be used 12 bytes
11
Prof. Rick Han, University of Colorado at Boulder More on DNS (2) DNS helps with Load distribution (cont.) DNS round robin to N servers Akamai’zing – Smarter than DNS round robin: choose the server closest to you – better response time! Akamai serves a subset of cnn.com Each URL in Akamai subset has a name for which the Akamai DNS server is authoritative www.cnn.com/foo.gif a128.g.akamai.net/foo.gif Server Farm DNS Client
12
Prof. Rick Han, University of Colorado at Boulder More on DNS (3) RFC 1794, DNS Support for Load Balancing DNS also helps with : Mail server aliasing Given hotmail.com, return the specific host name BIND is a popular name server for Unix
13
Prof. Rick Han, University of Colorado at Boulder More on DNS (4) Dynamic DNS: Mapping your well-known Web name to a dynamic IP address (from DHCP) Suppose you’ve reserved a hostname www.myweb.org to serve Web pages from your home PC Each time your PC connects via cable/DSL, your ISP assigns your PC a different dynamic IP address via DHCP Users won’t know your dynamic IP address but may remember your Web address. How can they reach you? Solution: your PC includes code snippet to update DNS each time your PC gets a new IP address via DHCP Your PC must have authorization at a DNS server to update its DNS record Dynamic DNS services are being offered on the Web, some for free, others you pay
14
Prof. Rick Han, University of Colorado at Boulder Load Balancing Techniques HTTP Redirection DNS Load Balancing Router-based Zany idea #1: N servers each advertise the same IP address. Let IP shortest-hop routing determine the nearest server. Hopefully no loops.
15
Prof. Rick Han, University of Colorado at Boulder Load Balancing Techniques (2) Router-based Better idea: Place an IP router in front of N servers – the router balances the load Example: each server has different IP address, and router substitutes IP address of lightest loaded server If a TCP connection is established to a specific server X, router must remember to route packets for this TCP connection to server X only router can’t just choose most lightly loaded server L, because L might not be X, so server L would not be expecting server X’s TCP packets NAT-Based (see NAT section)
16
Prof. Rick Han, University of Colorado at Boulder Email: SMTP, POP, IMAP SMTP – Simple Mail Transfer Protocol Defines email header and email body ASCII text for header and body To:, Subject:, Date:, From:, Received: MIME = Multipurpose Internet Mail Extensions Supplements original email RFC 822 Allows email to carry more than just text: images, audio, video, MS Word, …
17
Prof. Rick Han, University of Colorado at Boulder Email: SMTP, POP, IMAP (2) MIME = Multipurpose Internet Mail Extensions Augments email header with fields MIME-version:, Content-Description:, Content-Transfer-Encoding: Content-Type: namely, the MIME type text/html application/postscript image/gif multipart – allows multiple types in an email, e.g. multipart/mixed; each part has its own header
18
Prof. Rick Han, University of Colorado at Boulder Email: SMTP, POP, IMAP (3) Mail client uses SMTP over TCP to send to mail server Mail reader uses POP3 or IMAP4 to read email from mail server SMTP Sendmail is UNIX SMTP implementation Mail may traverse several mail forwarding gateways en route to destination Each gateway will have sendmail or an SMTP equivalent to set up a new SMTP connection SMTP client sends a command (HELO, MAIL, RCPT, …), server responds with a code
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.