Winter 2002 1
CMPE 155
Week 5
Winter 2002 2
Uniform Resource Locator (URL)
Way to identify objects (pages).– What is page called?– Where is it located? – How to access page?
URL has 3 parts:– Protocol (or scheme).– Machine’s name/address.– Local name (file name).
Winter 2002 3
URL
Ability to handle other protocols.– HTTP, FTP, news, gopher, mail, telnet.
Universal Resource Identifier (URI).– Location transparency.– Replication.
Winter 2002 4
HyperText Markup Language (HTML)
Allows users to produce Web pages including text, graphics, pointers, etc.
Application of the ISO SGML (Standard Generalized Markup Language) standard.
Markup language: describe how objects are to be formatted.– Contains explicit commands for formatting.– Example: <B> and </B>.– Advantages: easy to parse.
Winter 2002 5
Forms
HTML 1.0: one-way exchange.– Enable users to get information from
servers.– Users could not send information back.– Example: on-line order forms.
HTML 2.0 allows forms.– INPUT, SUBMIT.– <FORM> and </FORM>.
Winter 2002 6
CGI Common Gateway Interface. CGI scripts: programs that read input,
process it, and generate output.– Example: after completing a form, user clicks
on SUBMIT; this causes browser to invoke associated CGI script (given by URL). CGI script can generate output in the form of a HTML page that is returned to browser, which interprets and displays it.
– Commercial use of the Web.
Winter 2002 7
Making the Web more interactive
HTML used to write static Web pages. With CGI, some “activation” possible. Java makes the Web more interactive.
– Java program is executed directly on the client’s machine.
– Allows to add animation, sound, etc. to Web pages efficiently
– Remote execution model.• Instead of buying software, installing it, etc., just click on the
appropriate applet from vendor’s Web page and get applet downloaded, executed, etc.
Winter 2002 8
Java
Developed at Sun Microsystems. Originally targeted embedded devices
(e.g., “smart” appliances). Object-oriented language a la C++.
Winter 2002 9
Java and the Web Web page can point to a Java program, or
applet.– Browser gets to the applet pointer, it downloads the
applet to the client’s machine where it is executed.• Example: Income tax filing.
– Go to IRS Web page, get appropriate tax applet downloaded; applet contacts employer, banks, etc, fills tax form and returns to user for verification.
– Security issues:• Applet cannot perform unauthorized access.
Winter 2002 10
More servers: DNS and Mail
Winter 2002 11
Domain Name System (DNS)
Basic function: translation of names (ASCII strings) to network (IP) addresses and vice-versa.
Example: – zephyr.isi.edu <-> 128.9.160.160
Winter 2002 12
History Original approach (ARPANET, 1970’s):
– File hosts.txt listed all hosts and their IP addresses.
– Every night every host fetches file from central repository.
– OK for a few hundred hosts.– Scalability?
• File size.• Centrally managed.
Winter 2002 13
DNS
Hierarchical name space. Distributed database. RFCs 1034 and 1035.
Winter 2002 14
How is it used?
Client-server model.– Client DNS (running on client hosts), or
resolver.– Application calls resolver with name.– Resolver contacts local DNS server (using
UDP) passing the name.– Server returns corresponding IP address.
Winter 2002 15
Namespace Flat versus hierarchical. Flat:
– Sequence of characters with no structure.– Short, convenient names.– But, doesn’t scale! Why?
• Unique names.• Hard to decentralize.
Hierarchical:– Name space partitioned and decentralized.– Portions delegated to different authorities.
Winter 2002 16
DNS Name Space
Tree-based hierarchy.
int com edu gov mil org net us ca …
usc
cs ee
ibm
eng sales
Winter 2002 17
Name Space Structure Top-level domains:
– Generic.– Countries.
Leaf domains: no sub-domains. In practice all US organizations are
under a generic domain, while everything outside the US is under the corresponding country domain.
Winter 2002 18
DNS Names Domain names:
– Concatenation of all domain names starting from its own all the way to the root separated by “.”.
– Refers to a tree node and all names under it.– Case insensitive.– Components up to 63 characters.– Full name less than 255 characters.
Winter 2002 19
Name Space Management Domains are autonomous.
– Organizational boundaries.– Each domain manages its own name space
independently of other domains. Delegation:
– When creating new domain: register with parent domain.
• For name uniqueness.• For name resolution.
Winter 2002 20
Resource Records Entry in the DNS database. Several types of entries or RRs. Example: RR “A” contains IP address. Name <-> several resource records. RR format: five-tuple.
– Name.– TTL (in seconds).– Class (usually “IN” for Internet info).– Type: type of RR.– Value.
Winter 2002 21
RR Types 1 SOA: start of authority.
– Marks beginning of zone’s database.– Provides general info about the zone: e-mail
address of admin, default TTL, etc.
A: address.– Contains 32-bit IP address.– Single name <-> several A RRs.
MX: mail exchange.– Name of mail server for this domain.
Winter 2002 22
RR Types 2 NS: name server.
– Name of name server for this domain. CNAME: canonical name.
– Alias. HINFO: host description.
– Provides information about host, e.g., CPU type, OS, etc.
TXT: arbitrary string of characters.– Generic description of the domain, where it is
located, etc.
Winter 2002 23
Name Servers Entire database in a single name server.
– Practical?– Why?
DNS database is partitioned into zones. Each zone contains part of the DNS tree. Zone <-> name server.
– Each zone may be served by more than 1 server.– A server may serve multiple zones.
Primary and secondary name servers.
Winter 2002 24
Name Resolution 1 Application wants to resolve name. Resolver sends query to local name server.
– Resolver configured with list of local name servers.– Select servers in round-robin fashion.
If name is local, local name server returns matching authoritative RRs.– Authoritative RR comes from authority managing the
RR and is always correct.– Cached RRs may be out of date.
Winter 2002 25
Name Resolution 2
If information not available locally (not even cached), local NS will have to ask someone else.– It asks the server of the top-level domain of
the name requested.
Winter 2002 26
Recursive Resolution Recursive query:
– Each server that doesn’t have info forwards it to someone else.
– Response finds its way back. Alternative: iterative resolution
– Name server not able to resolve query, sends back the name of the next server to try.
– Some servers use this method.– More control for clients.
Winter 2002 27
Example Suppose resolver on flits.cs.vu.nl wants to
resolve linda.cs.yale.edu.– Local NS, cs.vu.nl, gets queried but cannot resolve it.– It then contacts .edu server.– .edu server forwards query to yale.edu server.– yale.edu contacts cs.yale.edu, which has the
authoritative RR.– Response finds its way back to originator.– cs.vu.nl caches this info.
• Not authoritative (since may be out-of-date).• RR TTL determines how long RR should be cached.
Winter 2002 28
Caching
Name servers cache recent requests and corresponding mappings.
Also, cache server that provided mapping.
Cached information is non-authoritative. Clients may choose to use them or go
to authoritative server for fresh copy.
Winter 2002 29
Cache consistency
TTL: how long cached copy is valid. Specified by original server. May be different for each object. Long versus short TTLs.
Winter 2002 30
More details…
RFC 1034 and 1035.
Winter 2002 31
Electronic Mail
Non-interactive.– Deferred mail (e.g., destination temporarily
unavailable). Spooling:
– Message delivery as background activity.– Mail spool: temporary storage area for
outgoing mail.
Winter 2002 32
Mail system
Userinterface
Usersends mail
Userreads mail
Outgoingmailspool
Mailboxes incomingmail
Client(send)
Server(receive)
TCPconnection(outgoing)
TCPconnection(incoming)
Winter 2002 33
Observations
When user sends mail, message stored is system spool area.
Client transfer runs on background. Initiates transfer to remote machine. If transfer succeeds, local copy of
message removed; otherwise, tries again later (30 min) for a maximum interval (3 days).
Winter 2002 34
Mail alias expansion
Mapping of e-mail identifiers to mail addresses.– Mail interface consults local alias database and
performs mapping before passing message to outgoing mail spool.
– One-to-many (e.g., mailing lists) and many-to-one (e.g., multiple ways to refer to a single user) mapping.
– Incoming mail also goes through alias expansion before delivery.
Winter 2002 35
SMTP
Simple Mail Transfer Protocol How messages are transferred over a
TCP/IP internet. Defines commands used to exchange
mail between mail clients and servers. Problems reported to user by e-mail.
Winter 2002 36
Example SMTP exchangeUser [email protected] sends message to jones, green, and [email protected].
S: 220 beta.gov readyC: Helo alpha.eduS: 250 beta.govC: MAIL FROM [email protected]: 250 OKC: RCPT TO: [email protected]: 250 OKC: RCPT TO: [email protected]: 550 no such userC: DATA …
Winter 2002 37
Mail retrieval
SMTP implies server is always listening. What about machines with intermittent
Internet access?– 2-stage delivery: message delivered to
user permanent mailbox; then user connects to retrieve messages.
– User needs protocol to retrieve messages from “permanent” mailboxes.
Winter 2002 38
Post Office Protocol version 3
POP3. User invokes POP3 client; connects to POP3
server through TCP. Requires authentication (user id and passwd). Commands to retrieve and delete messages
from permanent mailbox. Mail server needs to run SMTP and POPP3.
– Mailbox a shared data.
Winter 2002 39
More details…
RFC 821 and 822 specify SMTP and its message formats.