Docstoc

Computer Networks

Document Sample
Computer Networks Powered By Docstoc
					                 Computer Networks
                     Application Layer


                      Paolo Costa
                     costa@cs.vu.nl
              http://www.cs.vu.nl/~costa

                   Vrije Universiteit Amsterdam


                       June 18, 2008


Paolo Costa             07 - Application Layer    1 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System




       Paolo Costa             07 - Application Layer   2 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System
    Electronic Mail




       Paolo Costa             07 - Application Layer   2 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System
    Electronic Mail
    World Wide Web




       Paolo Costa             07 - Application Layer   2 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System
    Electronic Mail
    World Wide Web
    Multimedia




       Paolo Costa             07 - Application Layer   2 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System
    Electronic Mail
    World Wide Web
    Multimedia
    Peer-to-peer




       Paolo Costa             07 - Application Layer   2 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System
    Electronic Mail
    World Wide Web
    Multimedia
    Peer-to-peer
         Gnutella




       Paolo Costa             07 - Application Layer   2 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System
    Electronic Mail
    World Wide Web
    Multimedia
    Peer-to-peer
         Gnutella
         Skype




       Paolo Costa             07 - Application Layer   2 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System
    Electronic Mail
    World Wide Web
    Multimedia
    Peer-to-peer
         Gnutella
         Skype
         Emule




       Paolo Costa             07 - Application Layer   2 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System
    Electronic Mail
    World Wide Web
    Multimedia
    Peer-to-peer
         Gnutella
         Skype
         Emule
         BitTorrent




       Paolo Costa             07 - Application Layer   2 / 48
 Application Layer


Now, we will study some real
network applications:
    Domain Name System
    Electronic Mail
    World Wide Web
    Multimedia
    Peer-to-peer
         Gnutella
         Skype
         Emule
         BitTorrent
         Distributed Hash Table
         (Chord, Kadmelia)


       Paolo Costa                07 - Application Layer   2 / 48
The Domain Name System
  Every host has a worldwide unique name that is bound to an IP
  address.
       originally all mapping were contained in the file hosts
       in 1982, they switch to the Domain Name System (DNS)




    Paolo Costa             07 - Application Layer   Domain Name System   3 / 48
The Domain Name System
  Every host has a worldwide unique name that is bound to an IP
  address.
       originally all mapping were contained in the file hosts
       in 1982, they switch to the Domain Name System (DNS)
  DNS provides name-lookup facilities: when given a hostname, it
  returns that host’s IP address.




  A domain name is a path from a leaf node up to the root. A
  domain is a subtree in the domain name space


    Paolo Costa             07 - Application Layer   Domain Name System   3 / 48
The Domain Name System
  Every host has a worldwide unique name that is bound to an IP
  address.
       originally all mapping were contained in the file hosts
       in 1982, they switch to the Domain Name System (DNS)
  DNS provides name-lookup facilities: when given a hostname, it
  returns that host’s IP address.




  A domain name is a path from a leaf node up to the root. A
  domain is a subtree in the domain name space
  Each domain can have a set of resource records which are stored
  (in a file) at name servers
    Paolo Costa             07 - Application Layer   Domain Name System   3 / 48
DNS Name Servers
  Idea: Divide the name space into a collection of non-overlapping
  zones, each one taken care of by one or more name servers:




    Paolo Costa           07 - Application Layer   Domain Name System   4 / 48
DNS Name Servers
  Idea: Divide the name space into a collection of non-overlapping
  zones, each one taken care of by one or more name servers:




  Root servers: 13 “root” DNS servers know where the top-level
  servers are (labeled A through M)
       see http://www.root-servers.org




    Paolo Costa              07 - Application Layer   Domain Name System   4 / 48
DNS Name Servers
  Idea: Divide the name space into a collection of non-overlapping
  zones, each one taken care of by one or more name servers:




  Root servers: 13 “root” DNS servers know where the top-level
  servers are (labeled A through M)
       see http://www.root-servers.org
  Top-level domain servers: each one is associated with a top-level
  domain (e.g., .com, .edu, .ch, .org, .tv)




    Paolo Costa              07 - Application Layer   Domain Name System   4 / 48
DNS Name Servers
  Idea: Divide the name space into a collection of non-overlapping
  zones, each one taken care of by one or more name servers:




  Root servers: 13 “root” DNS servers know where the top-level
  servers are (labeled A through M)
       see http://www.root-servers.org
  Top-level domain servers: each one is associated with a top-level
  domain (e.g., .com, .edu, .ch, .org, .tv)
  Authoritative servers: for each domain, there is an authoritative
  DNS server that holds the map of hosts within that domain


    Paolo Costa              07 - Application Layer   Domain Name System   4 / 48
DNS Name Servers
  Idea: Divide the name space into a collection of non-overlapping
  zones, each one taken care of by one or more name servers:




  Root servers: 13 “root” DNS servers know where the top-level
  servers are (labeled A through M)
       see http://www.root-servers.org
  Top-level domain servers: each one is associated with a top-level
  domain (e.g., .com, .edu, .ch, .org, .tv)
  Authoritative servers: for each domain, there is an authoritative
  DNS server that holds the map of hosts within that domain
  A resolver is capable of sending DNS queries to a name server
       a resolver is often just a library linked to an application.
    Paolo Costa                07 - Application Layer       Domain Name System   4 / 48
Resource Records

  Every domain, whether it is a single host or a top-level domain,
  can have a set of resource records associated with it.
  For a single host, the most common resource record is just its IP
  address, but many other kinds of resource records also exist.




    Paolo Costa            07 - Application Layer   Domain Name System   5 / 48
Resource Records

   Every domain, whether it is a single host or a top-level domain,
   can have a set of resource records associated with it.
   For a single host, the most common resource record is just its IP
   address, but many other kinds of resource records also exist.
   A resource record is a five-tuple (Class is always IN)
    Domain_name, Time_to_live, Class, Type, Value

 Type         Associated
                           Description
              entity
 SOA          Zone         Holds information on the represented zone
 A            Host         Contains an IP address of the host this node represents
 MX           Domain       Refers to a mail server to handle mail addressed to this node
 SRV          Domain       Refers to a server handling a specific service
 NS           Zone         Refers to a name server that implements the represented zone
 CNAME        Node         Symbolic link with the primary name of the represented node
 PTR          Host         Contains the canonical name of a host
 HINFO        Host         Holds information on the host this node represents
 TXT          Any kind     Contains any entity-specific information considered useful


        Paolo Costa                  07 - Application Layer          Domain Name System    5 / 48
Resource Record
Example




      Paolo Costa   07 - Application Layer   Domain Name System   6 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                            root
                         DNS servers

                                                        .nl
                                                    DNS servers


                                                              .vu.nl
                                                            DNS server


                                                             cs.vu.nl
        application
                                                            DNS server
       www.cs.vu.nl?
    Paolo Costa            07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                            root
                         DNS servers

                                                        .nl
                                                    DNS servers


                                                              .vu.nl
                                                            DNS server


                                                             cs.vu.nl
        application
                                                            DNS server
       www.cs.vu.nl?
    Paolo Costa            07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                            root
                         DNS servers

                                                        .nl
                                                    DNS servers
           local DNS
              ?
                                                              .vu.nl
                                                            DNS server


                                                             cs.vu.nl
        application
                                                            DNS server
       www.cs.vu.nl?
    Paolo Costa            07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                              root
                           DNS servers
                       ?
                                                         .nl
                                                     DNS servers
           local DNS


                                                               .vu.nl
                                                             DNS server


                                                              cs.vu.nl
        application
                                                             DNS server
       www.cs.vu.nl?
    Paolo Costa             07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                              root
                           DNS servers

                                                   .nl
                                              DNS servers
                       see .nl at 192.5.5.241. . .
           local DNS


                                                         .vu.nl
                                                       DNS server


                                                        cs.vu.nl
        application
                                                       DNS server
       www.cs.vu.nl?
    Paolo Costa              07 - Application Layer   Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                            root
                         DNS servers

                                 ?                      .nl
                                                    DNS servers
           local DNS


                                                              .vu.nl
                                                            DNS server


                                                             cs.vu.nl
        application
                                                            DNS server
       www.cs.vu.nl?
    Paolo Costa            07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                              root
                           DNS servers

                                                          .nl
                                                      DNS servers
           local DNS
                   see .vu.nl at 193.176.144.2. . .
                                                                .vu.nl
                                                              DNS server


                                                               cs.vu.nl
        application
                                                              DNS server
       www.cs.vu.nl?
    Paolo Costa              07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                            root
                         DNS servers

                                                        .nl
                                                    DNS servers
           local DNS                       ?

                                                              .vu.nl
                                                            DNS server


                                                             cs.vu.nl
        application
                                                            DNS server
       www.cs.vu.nl?
    Paolo Costa            07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                               root
                            DNS servers

                                                           .nl
                                                       DNS servers
           local DNS


                                                                 .vu.nl
                  see cs.vu.nl at 130.37.129.4. . .            DNS server


                                                                cs.vu.nl
        application
                                                               DNS server
       www.cs.vu.nl?
    Paolo Costa               07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                            root
                         DNS servers

                                                        .nl
                                                    DNS servers
           local DNS


                                             ?                .vu.nl
                                                            DNS server


                                                             cs.vu.nl
        application
                                                            DNS server
       www.cs.vu.nl?
    Paolo Costa            07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                            root
                         DNS servers

                                                        .nl
                                                    DNS servers
           local DNS


                                                              .vu.nl
                                                            DNS server
                       130.37.20.20!

                                                             cs.vu.nl
        application
                                                            DNS server
       www.cs.vu.nl?
    Paolo Costa            07 - Application Layer          Domain Name System   7 / 48
DNS Iterative Name Resolution
  Name resolution can be iterative, in which the client repeatedly
  asks name servers to resolve part of a name
  It mirrors the hierarchical structure of the namespace
       in many cases, caching can be employed
                             root
                          DNS servers

                                                         .nl
                                                     DNS servers
           local DNS
                 130.37.20.20!
                                                               .vu.nl
                                                             DNS server


                                                              cs.vu.nl
        application
                                                             DNS server
       www.cs.vu.nl?
    Paolo Costa             07 - Application Layer          Domain Name System   7 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                                                            .nl
                                                        DNS servers
             local DNS


                                                                  .vu.nl
                                                                DNS server


                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                                                            .nl
                                                        DNS servers
             local DNS


                                                                  .vu.nl
                                                                DNS server


                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                                                            .nl
                                                        DNS servers
             local DNS
                ?
                                                                  .vu.nl
                                                                DNS server


                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers
                         ?
                                                            .nl
                                                        DNS servers
             local DNS


                                                                  .vu.nl
                                                                DNS server


                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers
                                                        ?

                                                            .nl
                                                        DNS servers
             local DNS


                                                                  .vu.nl
                                                                DNS server


                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                                                            .nl
                                                        DNS servers
             local DNS
                                                                    ?

                                                                  .vu.nl
                                                                DNS server


                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                                                            .nl
                                                        DNS servers
             local DNS


                                                                  .vu.nl
                                                                DNS server

                                                                          ?
                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                                                            .nl
                                                        DNS servers
             local DNS


                                                                  .vu.nl
                                                                DNS server

                                                        130.37.20.20!
                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                                                            .nl
                                                        DNS servers
             local DNS
                                                   130.37.20.20!
                                                                     .vu.nl
                                                                   DNS server


                                                                    cs.vu.nl
          application
                                                                   DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                               130.37.20.20!                .nl
                                                        DNS servers
             local DNS


                                                                  .vu.nl
                                                                DNS server


                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                                                            .nl
                          130.37.20.20!                 DNS servers
             local DNS


                                                                  .vu.nl
                                                                DNS server


                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Recursive Name Resolution
  With recursive resolution, a higher level server passes the query
  to a lower one instead of passing it back to the querying server.
         it requires more processing on higher-level nodes
  .
                                root
                             DNS servers

                                                            .nl
                                                        DNS servers
             local DNS
                   130.37.20.20!
                                                                  .vu.nl
                                                                DNS server


                                                                 cs.vu.nl
          application
                                                                DNS server
         www.cs.vu.nl ?
      Paolo Costa              07 - Application Layer          Domain Name System   8 / 48
DNS Address Resolution

  You can also find the name of a host when given its address:
  host 192.31.231.80 80.231.31.192.in-addr.arpa
  domain name pointer veldersschuit.cs.vu.nl




    Paolo Costa           07 - Application Layer   Domain Name System   9 / 48
DNS Address Resolution

  You can also find the name of a host when given its address:
  host 192.31.231.80 80.231.31.192.in-addr.arpa
  domain name pointer veldersschuit.cs.vu.nl
  Solution: IP addresses are stored in the special in-addr.arpa
  domain:
                                                    .


                                                   arpa


                                              in-addr

                  0                                     192   255


                  0                                 31        255


                  0                                     231   255


                  0                                      80   255



    Paolo Costa           07 - Application Layer                Domain Name System   9 / 48
Round robin DNS
  Round robin DNS is a technique for balancing the load of
  geographically-distributed Web servers
  Round robin works by responding to DNS requests not with a
  single IP address, but a list of IP addresses
       the order in which IP addresses are returned is the key
       the IP address at the top of the list is returned a set number of
       times before it is moved to the bottom, thus promoting the second
       IP address to the top of the list




    Paolo Costa              07 - Application Layer   Domain Name System   10 / 48
Round robin DNS
  Round robin DNS is a technique for balancing the load of
  geographically-distributed Web servers
  Round robin works by responding to DNS requests not with a
  single IP address, but a list of IP addresses
       the order in which IP addresses are returned is the key
       the IP address at the top of the list is returned a set number of
       times before it is moved to the bottom, thus promoting the second
       IP address to the top of the list
  e.g., executing host www.google.com returns
  www.google.com is an   alias for www.l.google.com.
  www.l.google.com has   address 66.249.91.99
  www.l.google.com has   address 66.249.91.104
  www.l.google.com has   address 66.249.91.103
  www.l.google.com has   address 66.249.91.147




    Paolo Costa              07 - Application Layer    Domain Name System   10 / 48
Round robin DNS
  Round robin DNS is a technique for balancing the load of
  geographically-distributed Web servers
  Round robin works by responding to DNS requests not with a
  single IP address, but a list of IP addresses
       the order in which IP addresses are returned is the key
       the IP address at the top of the list is returned a set number of
       times before it is moved to the bottom, thus promoting the second
       IP address to the top of the list
  e.g., executing host www.google.com returns
  www.google.com is an   alias for www.l.google.com.
  www.l.google.com has   address 66.249.91.99
  www.l.google.com has   address 66.249.91.104
  www.l.google.com has   address 66.249.91.103
  www.l.google.com has   address 66.249.91.147
  Each DNS reply has associated a TTL, telling how long it can be
  cached
       if load-balancing is used, TTL must be small (e.g., 18 seconds for
       google.com)


    Paolo Costa              07 - Application Layer    Domain Name System   10 / 48
Round robin DNS
  Round robin DNS is a technique for balancing the load of
  geographically-distributed Web servers
  Round robin works by responding to DNS requests not with a
  single IP address, but a list of IP addresses
       the order in which IP addresses are returned is the key
       the IP address at the top of the list is returned a set number of
       times before it is moved to the bottom, thus promoting the second
       IP address to the top of the list
  e.g., executing host www.google.com returns
  www.google.com is an   alias for www.l.google.com.
  www.l.google.com has   address 66.249.91.99
  www.l.google.com has   address 66.249.91.104
  www.l.google.com has   address 66.249.91.103
  www.l.google.com has   address 66.249.91.147
  Each DNS reply has associated a TTL, telling how long it can be
  cached
       if load-balancing is used, TTL must be small (e.g., 18 seconds for
       google.com)
  In some cases, the address returned also depends on the
  geographic location of the querying node (e.g., Akamai)
    Paolo Costa              07 - Application Layer    Domain Name System   10 / 48
Lab Session
nslookup

    The nslookup command can be used to find various details
    relating to DNS
    e.g., by typing nslookup www.cs.vu.nl, we can obtain the IP
    address of the google servers
    Server:          192.168.1.254
    Address:         192.168.1.254#53

    Non-authoritative answer:
    www.cs.vu.nl    canonical name = soling-public.few.vu.nl.
    Name:   soling-public.few.vu.nl
    Address: 130.37.20.20




       Paolo Costa            07 - Application Layer   Domain Name System   11 / 48
Lab Session
nslookup

    The nslookup command can be used to find various details
    relating to DNS
    e.g., by typing nslookup www.cs.vu.nl, we can obtain the IP
    address of the google servers
    Server:          192.168.1.254
    Address:         192.168.1.254#53

    Non-authoritative answer:
    www.cs.vu.nl    canonical name = soling-public.few.vu.nl.
    Name:   soling-public.few.vu.nl
    Address: 130.37.20.20

    The first line specifies the address of the DNS server used




       Paolo Costa            07 - Application Layer   Domain Name System   11 / 48
Lab Session
nslookup

    The nslookup command can be used to find various details
    relating to DNS
    e.g., by typing nslookup www.cs.vu.nl, we can obtain the IP
    address of the google servers
    Server:          192.168.1.254
    Address:         192.168.1.254#53

    Non-authoritative answer:
    www.cs.vu.nl    canonical name = soling-public.few.vu.nl.
    Name:   soling-public.few.vu.nl
    Address: 130.37.20.20

    The first line specifies the address of the DNS server used
    Non-autorhative means that the reply has been extracted from a
    previous cache
    nslookup -type=NS www.cs.vu.nl tells us the address of
    the authoritative DNS server


       Paolo Costa            07 - Application Layer   Domain Name System   11 / 48
Lab Session
nslookup

    The nslookup command can be used to find various details
    relating to DNS
    e.g., by typing nslookup www.cs.vu.nl, we can obtain the IP
    address of the google servers
    Server:          192.168.1.254
    Address:         192.168.1.254#53

    Non-authoritative answer:
    www.cs.vu.nl    canonical name = soling-public.few.vu.nl.
    Name:   soling-public.few.vu.nl
    Address: 130.37.20.20

    The first line specifies the address of the DNS server used
    Non-autorhative means that the reply has been extracted from a
    previous cache
    nslookup -type=NS www.cs.vu.nl tells us the address of
    the authoritative DNS server
    nslookup www.cs.vu.nl star.cs.vu.nl asks the server
    star (the authorative DNS) for a reply
       Paolo Costa            07 - Application Layer   Domain Name System   11 / 48
Lab Session
dig

      Domain Information Groper (dig) is a network tool that queries
      DNS name servers.
      e.g., dig www.cs.vu.nl
       ; <<>> DiG 9.4.2 <<>> www.cs.vu.nl
      ;; QUESTION SECTION:
      ;www.cs.vu.nl.                  IN                  A

      ;; ANSWER SECTION:
      www.cs.vu.nl.           57224          IN           CNAME   soling-public.few.vu.n
      soling-public.few.vu.nl. 86398         IN           A       130.37.20.20

      ;;   Query time: 82 msec
      ;;   SERVER: 192.168.1.254#53(192.168.1.254)
      ;;   WHEN: Sun Jun 15 13:03:03 2008
      ;;   MSG SIZE rcvd: 78




           Paolo Costa           07 - Application Layer           Domain Name System   12 / 48
Lab Session
dig

      Domain Information Groper (dig) is a network tool that queries
      DNS name servers.
      e.g., dig www.cs.vu.nl
       ; <<>> DiG 9.4.2 <<>> www.cs.vu.nl
      ;; QUESTION SECTION:
      ;www.cs.vu.nl.                  IN                    A

      ;; ANSWER SECTION:
      www.cs.vu.nl.           57224            IN           CNAME   soling-public.few.vu.n
      soling-public.few.vu.nl. 86398           IN           A       130.37.20.20

      ;;   Query time: 82 msec
      ;;   SERVER: 192.168.1.254#53(192.168.1.254)
      ;;   WHEN: Sun Jun 15 13:03:03 2008
      ;;   MSG SIZE rcvd: 78

      dig also enables querying for other DNS record
              e.g., to obtain info about the mail server type dig MX cs.vu.nl
      similar information can also be obtained by running host with the
      -v option
           Paolo Costa             07 - Application Layer           Domain Name System   12 / 48
A Postal Service for the Internet




     Paolo Costa      07 - Application Layer   Electronic Mail   13 / 48
A Postal Service for the Internet



Paolo




        Paolo Costa   07 - Application Layer   Electronic Mail   13 / 48
A Postal Service for the Internet



Paolo
                                                    Guillaume




        Paolo Costa   07 - Application Layer   Electronic Mail   13 / 48
A Postal Service for the Internet
                      Paolo Costa
                      De Boelelaan 1081
                      Amsterdam, 1081 HV,NL

Paolo
                                          Guillaume Pierre          Guillaume
                                          De Boelelaan 1081
                                          Amsterdam, 1081 HV
                                          Netherlands




        Paolo Costa                07 - Application Layer      Electronic Mail   13 / 48
A Postal Service for the Internet
                      Paolo Costa
                      De Boelelaan 1081
                      Amsterdam, 1081 HV,NL

Paolo
                                          Guillaume Pierre                   Guillaume
                                          De Boelelaan 1081
                                          Amsterdam, 1081 HV
                                          Netherlands


                                                      Paolo Costa
                                                      Amsterdam, June 18, 2008
           Re: Italy vs. France (Euro 2008)
           Dear Guillaume,
           how about yesterday’s match ? ;)

           Take care,
           Paolo

        Paolo Costa                07 - Application Layer               Electronic Mail   13 / 48
Electronic Mail
   Features and Goals
        Asynchronous communication
               Alice sends a message when it is convenient to her
               Bob reads Alice’s message whenever he has time to do that
        One-to-many communication
               Alice can send a message to Bob and Charlie
               a mailing list sends messages to several receivers
        Multi-media content
               images and all sorts of attachments as well as normal text




     Paolo Costa                  07 - Application Layer            Electronic Mail   14 / 48
Electronic Mail
   Features and Goals
        Asynchronous communication
               Alice sends a message when it is convenient to her
               Bob reads Alice’s message whenever he has time to do that
        One-to-many communication
               Alice can send a message to Bob and Charlie
               a mailing list sends messages to several receivers
        Multi-media content
               images and all sorts of attachments as well as normal text
   Limitations
        No authentication
               messages can be modified
               messages can be forged
        No confidentiality
               the message can be read by others
        Little or no delivery guarantees
               messages can be accidentally lost or intentionally blocked
               no reliable acknowledgment system
     Paolo Costa                  07 - Application Layer            Electronic Mail   14 / 48
Architecture




   User agent
        allows a user to read, compose, reply to, send, and forward
        messages
        and also to save, classify, sort, search, . . .




     Paolo Costa              07 - Application Layer        Electronic Mail   15 / 48
Architecture




   User agent
        allows a user to read, compose, reply to, send, and forward
        messages
        and also to save, classify, sort, search, . . .
   Mail servers
        accept messages for remote delivery
               store messages in a local persistent queue
               deliver messages to a remote (destination) server using the transport
               protocol
        accept messages for local delivery
               save messages in some local persistent mailbox
        allow user agents to access local mailboxes
               user agents can retrieve and/or delete messages
               this is done through an access protocol
     Paolo Costa                  07 - Application Layer           Electronic Mail   15 / 48
Email: Message Transfer
  The message transfer agent extracts the destination host from the
  message, and queries DNS to obtain the destination address.
  DNS keeps track of mailers in MX records:
  nslookup -type=MX cs.vu.nl
  Server:         192.168.1.254
  Address:        192.168.1.254#53

  Non-authoritative answer:
  cs.vu.nl        mail exchanger = 1 mail.few.vu.nl.




    Paolo Costa            07 - Application Layer      Electronic Mail   16 / 48
Email: Message Transfer
  The message transfer agent extracts the destination host from the
  message, and queries DNS to obtain the destination address.
  DNS keeps track of mailers in MX records:
  nslookup -type=MX cs.vu.nl
  Server:         192.168.1.254
  Address:        192.168.1.254#53

  Non-authoritative answer:
  cs.vu.nl        mail exchanger = 1 mail.few.vu.nl.

  Example: mail for costa@cs.vu.nl is sent to the message
  transfer agent on mail.few.vu.nl
       of course, mail is looked up as well to retrieve its IP address
  The message transfer agent extracts the user and makes an
  attempt to deposit the incoming message into the user’s mailbox.
  The user may then be notified.




    Paolo Costa              07 - Application Layer          Electronic Mail   16 / 48
Email: Message Transfer
  The message transfer agent extracts the destination host from the
  message, and queries DNS to obtain the destination address.
  DNS keeps track of mailers in MX records:
  nslookup -type=MX cs.vu.nl
  Server:         192.168.1.254
  Address:        192.168.1.254#53

  Non-authoritative answer:
  cs.vu.nl        mail exchanger = 1 mail.few.vu.nl.

  Example: mail for costa@cs.vu.nl is sent to the message
  transfer agent on mail.few.vu.nl
       of course, mail is looked up as well to retrieve its IP address
  The message transfer agent extracts the user and makes an
  attempt to deposit the incoming message into the user’s mailbox.
  The user may then be notified.
  Note: We’re assuming that the user’s mailbox is accessible for the
  agent, not necessarily the user.
       protocols exist that allow a user to remotely access the mailbox.
    Paolo Costa              07 - Application Layer          Electronic Mail   16 / 48
Simple Mail Transfer Protocol (SMTP)




   SMTP: (Simple Mail Transfer Protocol)
   Really simple (a reason of its success):
    1. set up TCP/IP connection between client and server
    2. client requests server to accept its messages
    3. server responds, so that client can send.




     Paolo Costa            07 - Application Layer          Electronic Mail   17 / 48
Simple Mail Transfer Protocol (SMTP)




   SMTP: (Simple Mail Transfer Protocol)
   Really simple (a reason of its success):
    1. set up TCP/IP connection between client and server
    2. client requests server to accept its messages
    3. server responds, so that client can send.
   It is an old protocol, compared to HTTP.
        the first RFCs date back to the early 80s
        it has some archaic characteristics. E.g., it is restricted to 7-bit
        characters

     Paolo Costa                07 - Application Layer           Electronic Mail   17 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                cs.vu.nl




                                                         server
      client




        Paolo Costa   07 - Application Layer   Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                  cs.vu.nl
                                               hello




                                                           server
      client




        Paolo Costa   07 - Application Layer     Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                  cs.vu.nl
                                                               hello
               hello, this is elet.polimi.it




                                                                           server
      client




        Paolo Costa                   07 - Application Layer     Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                          cs.vu.nl
                                                                       hello
               hello, this is elet.polimi.it
                                               hello elet.polimi.it, go ahead




                                                                                    server
      client




        Paolo Costa                   07 - Application Layer              Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                  cs.vu.nl
                                                               hello
               hello, this is elet.polimi.it
                                      hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it




                                                                           server
      client




        Paolo Costa                   07 - Application Layer     Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                  cs.vu.nl
                                                               hello
               hello, this is elet.polimi.it
                                      hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it
                                             okay, I got the sender




                                                                           server
      client




        Paolo Costa                   07 - Application Layer     Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                   cs.vu.nl
                                                                hello
               hello, this is elet.polimi.it
                                       hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it
                                              okay, I got the sender
               the message is for costa@cs.vu.nl




                                                                            server
      client




        Paolo Costa                   07 - Application Layer      Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                   cs.vu.nl
                                                                hello
               hello, this is elet.polimi.it
                                       hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it
                                              okay, I got the sender
               the message is for costa@cs.vu.nl




                                                                            server
      client




                                             okay, I got the receiver




        Paolo Costa                   07 - Application Layer      Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                   cs.vu.nl
                                                                hello
               hello, this is elet.polimi.it
                                       hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it
                                              okay, I got the sender
               the message is for costa@cs.vu.nl




                                                                            server
      client




                                             okay, I got the receiver
               here comes the message




        Paolo Costa                   07 - Application Layer      Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                   cs.vu.nl
                                                                hello
               hello, this is elet.polimi.it
                                       hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it
                                              okay, I got the sender
               the message is for costa@cs.vu.nl




                                                                            server
      client




                                             okay, I got the receiver
               here comes the message
                                             okay, I’m ready to copy




        Paolo Costa                   07 - Application Layer      Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                   cs.vu.nl
                                                                hello
               hello, this is elet.polimi.it
                                       hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it
                                              okay, I got the sender
               the message is for costa@cs.vu.nl




                                                                            server
      client




                                             okay, I got the receiver
               here comes the message
                                             okay, I’m ready to copy
               ...




        Paolo Costa                   07 - Application Layer      Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                   cs.vu.nl
                                                                hello
               hello, this is elet.polimi.it
                                       hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it
                                              okay, I got the sender
               the message is for costa@cs.vu.nl




                                                                            server
      client




                                             okay, I got the receiver
               here comes the message
                                             okay, I’m ready to copy
               ...
                                            okay, I got the message




        Paolo Costa                   07 - Application Layer      Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                   cs.vu.nl
                                                                hello
               hello, this is elet.polimi.it
                                       hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it
                                              okay, I got the sender
               the message is for costa@cs.vu.nl




                                                                            server
      client




                                             okay, I got the receiver
               here comes the message
                                             okay, I’m ready to copy
               ...
                                            okay, I got the message
               bye now



        Paolo Costa                   07 - Application Layer      Electronic Mail    18 / 48
Simple Mail Transfer Protocol (SMTP)
Abstract Example


   elet.polimi.it                                                    cs.vu.nl
                                                                 hello
               hello, this is elet.polimi.it
                                       hello elet.polimi.it, go ahead
               I have a message from costa@elet.polimi.it
                                              okay, I got the sender
               the message is for costa@cs.vu.nl




                                                                             server
      client




                                             okay, I got the receiver
               here comes the message
                                             okay, I’m ready to copy
               ...
                                            okay, I got the message
               bye now
                                                             okay, bye


        Paolo Costa                   07 - Application Layer       Electronic Mail    18 / 48
Concrete Example

  elet.polimi.it                                cs.vu.nl




                                                        server
     client




       Paolo Costa   07 - Application Layer   Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                         cs.vu.nl
                                              220 cs.vu.nl




                                                                   server
     client




       Paolo Costa   07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it




                                                                          server
     client




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                                           250 ok




                                                                          server
     client




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>




                                                                          server
     client




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>
                                               250 ok




                                                                          server
     client




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>
                                               250 ok
              RCPT TO: <costa@cs.vu.nl>




                                                                          server
     client




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>
                                               250 ok
              RCPT TO: <costa@cs.vu.nl>




                                                                          server
     client




                                               250 ok




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>
                                               250 ok
              RCPT TO: <costa@cs.vu.nl>




                                                                          server
     client




                                               250 ok
              DATA




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>
                                               250 ok
              RCPT TO: <costa@cs.vu.nl>




                                                                          server
     client




                                               250 ok
              DATA
                  354 End data with <CR><LF>.<CR><LF>




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>
                                               250 ok
              RCPT TO: <costa@cs.vu.nl>




                                                                          server
     client




                                               250 ok
              DATA
                  354 End data with <CR><LF>.<CR><LF>
              ...




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>
                                               250 ok
              RCPT TO: <costa@cs.vu.nl>




                                                                          server
     client




                                               250 ok
              DATA
                  354 End data with <CR><LF>.<CR><LF>
              ...
                                 250 Message accepted




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>
                                               250 ok
              RCPT TO: <costa@cs.vu.nl>




                                                                          server
     client




                                               250 ok
              DATA
                  354 End data with <CR><LF>.<CR><LF>
              ...
                                 250 Message accepted
              QUIT




       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Concrete Example

  elet.polimi.it                                                cs.vu.nl
                                                     220 cs.vu.nl
              HELO elet.polimi.it
                                               250 ok
              MAIL FROM: <costa@elet.polimi.it>
                                               250 ok
              RCPT TO: <costa@cs.vu.nl>




                                                                          server
     client




                                               250 ok
              DATA
                  354 End data with <CR><LF>.<CR><LF>
              ...
                                 250 Message accepted
              QUIT
                                              221 Bye


       Paolo Costa          07 - Application Layer              Electronic Mail    19 / 48
Message Format




   From: costa@elet.polimi.it
   Date: Wed, 18 Jun 2006 13:48:22 +0200 (CEST)
   To: costa@cs.vu.nl
   Subject: how to send fake e-mail messages

   Hey Dude,
   I heard this story about forging messages.
   Do you know anything about that?
   ...




    Paolo Costa         07 - Application Layer    Electronic Mail   20 / 48
Message Format




   From: costa@elet.polimi.it
   Date: Wed, 18 Jun 2006 13:48:22 +0200 (CEST)     header
   To: costa@cs.vu.nl                               lines
   Subject: how to send fake e-mail messages

   Hey Dude,
   I heard this story about forging messages.
   Do you know anything about that?
   ...




    Paolo Costa         07 - Application Layer    Electronic Mail   20 / 48
Message Format




   From: costa@elet.polimi.it
   Date: Wed, 18 Jun 2006 13:48:22 +0200 (CEST)     header
   To: costa@cs.vu.nl                               lines
   Subject: how to send fake e-mail messages
                                                    empty line
   Hey Dude,
   I heard this story about forging messages.
   Do you know anything about that?
   ...




    Paolo Costa         07 - Application Layer    Electronic Mail   20 / 48
Message Format




   From: costa@elet.polimi.it
   Date: Wed, 18 Jun 2006 13:48:22 +0200 (CEST)     header
   To: costa@cs.vu.nl                               lines
   Subject: how to send fake e-mail messages
                                                    empty line
   Hey Dude,
   I heard this story about forging messages.       message
   Do you know anything about that?                 body
   ...




    Paolo Costa         07 - Application Layer    Electronic Mail   20 / 48
Message Format
Description



    Basic idea: Don’t prescribe anything concerning the content of a
    message, but specify only the header:
          To:            e-mail address(es) main destination
          Cc:            e-mail address(es) to send copies
          Bcc:           e-mail address(es) to send blind copies
          From:          name of sender(s)
          Sender:        e-mail address sender
          Received:      line added by each intermediate transfer agent
          Return-path:   return address
          Date:          the date and time the message was sent
          Subject:       short summary of the message
          Reply-To:      E-mail address to which replies should be sent




       Paolo Costa             07 - Application Layer        Electronic Mail   21 / 48
Message Format
Description



    Basic idea: Don’t prescribe anything concerning the content of a
    message, but specify only the header:
          To:            e-mail address(es) main destination
          Cc:            e-mail address(es) to send copies
          Bcc:           e-mail address(es) to send blind copies
          From:          name of sender(s)
          Sender:        e-mail address sender
          Received:      line added by each intermediate transfer agent
          Return-path:   return address
          Date:          the date and time the message was sent
          Subject:       short summary of the message
          Reply-To:      E-mail address to which replies should be sent
    The From: field is often the same as Sender:, so that the latter can
    be left out.


       Paolo Costa             07 - Application Layer        Electronic Mail   21 / 48
Received: Headers

    SMTP is almost completely oblivious to the content of a message.
    One exception is the Received: header.
    Every receiving SMTP server must add a Received: header.
Received: from tornado.few.vu.nl (tornado.few.vu.nl
[130.37.20.3]) by top.few.vu.nl with esmtp id m1K7vVc-000NDJC;
Wed, 18 Jun 2008 13:48:34 +0200




      Paolo Costa           07 - Application Layer     Electronic Mail   22 / 48
Received: Headers

    SMTP is almost completely oblivious to the content of a message.
    One exception is the Received: header.
    Every receiving SMTP server must add a Received: header.
Received: from tornado.few.vu.nl (tornado.few.vu.nl
[130.37.20.3]) by top.few.vu.nl with esmtp id m1K7vVc-000NDJC;
Wed, 18 Jun 2008 13:48:34 +0200
Received: from smtp2.elet.polimi.it (smtp2.elet.polimi.it
[131.175.120.37]) by tornado.few.vu.nl with esmtp id
m1K7vVb-000010C for <costa@cs.vu.nl>; Wed, 18 Jun 2008 13:48:34
+0200




      Paolo Costa           07 - Application Layer     Electronic Mail   22 / 48
Received: Headers

    SMTP is almost completely oblivious to the content of a message.
    One exception is the Received: header.
    Every receiving SMTP server must add a Received: header.
Received: from tornado.few.vu.nl (tornado.few.vu.nl
[130.37.20.3]) by top.few.vu.nl with esmtp id m1K7vVc-000NDJC;
Wed, 18 Jun 2008 13:48:34 +0200
Received: from smtp2.elet.polimi.it (smtp2.elet.polimi.it
[131.175.120.37]) by tornado.few.vu.nl with esmtp id
m1K7vVb-000010C for <costa@cs.vu.nl>; Wed, 18 Jun 2008 13:48:34
+0200
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp2.elet.polimi.it (Postfix) with ESMTP id 8CBE66F59A for
<costa@cs.vu.nl>; Wed, 18 Jun 2008 13:48:34 +0200 (CEST)




      Paolo Costa           07 - Application Layer     Electronic Mail   22 / 48
Received: Headers

    SMTP is almost completely oblivious to the content of a message.
    One exception is the Received: header.
    Every receiving SMTP server must add a Received: header.
Received: from tornado.few.vu.nl (tornado.few.vu.nl
[130.37.20.3]) by top.few.vu.nl with esmtp id m1K7vVc-000NDJC;
Wed, 18 Jun 2008 13:48:34 +0200
Received: from smtp2.elet.polimi.it (smtp2.elet.polimi.it
[131.175.120.37]) by tornado.few.vu.nl with esmtp id
m1K7vVb-000010C for <costa@cs.vu.nl>; Wed, 18 Jun 2008 13:48:34
+0200
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp2.elet.polimi.it (Postfix) with ESMTP id 8CBE66F59A for
<costa@cs.vu.nl>; Wed, 18 Jun 2008 13:48:34 +0200 (CEST)
Received: from smtp2.elet.polimi.it ([127.0.0.1]) by localhost
(smtp2.elet.polimi.it [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id l20g9fscAq2b for <costa@cs.vu.nl>; Wed, 18 Jun
2008 13:48:32 +0200 (CEST)


      Paolo Costa           07 - Application Layer     Electronic Mail   22 / 48
Received: Headers

    SMTP is almost completely oblivious to the content of a message.
    One exception is the Received: header.
    Every receiving SMTP server must add a Received: header.
Received: from tornado.few.vu.nl (tornado.few.vu.nl
[130.37.20.3]) by top.few.vu.nl with esmtp id m1K7vVc-000NDJC;
Wed, 18 Jun 2008 13:48:34 +0200
Received: from smtp2.elet.polimi.it (smtp2.elet.polimi.it
[131.175.120.37]) by tornado.few.vu.nl with esmtp id
m1K7vVb-000010C for <costa@cs.vu.nl>; Wed, 18 Jun 2008 13:48:34
+0200
Received: from localhost (localhost.localdomain [127.0.0.1])
by smtp2.elet.polimi.it (Postfix) with ESMTP id 8CBE66F59A for
<costa@cs.vu.nl>; Wed, 18 Jun 2008 13:48:34 +0200 (CEST)
Received: from smtp2.elet.polimi.it ([127.0.0.1]) by localhost
(smtp2.elet.polimi.it [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id l20g9fscAq2b for <costa@cs.vu.nl>; Wed, 18 Jun
2008 13:48:32 +0200 (CEST)


      Paolo Costa           07 - Application Layer     Electronic Mail   22 / 48
Message vs. Envelope


Consider the following SMTP client directives
1. MAIL FROM: <costa@elet.polimi.it>




      Paolo Costa            07 - Application Layer   Electronic Mail   23 / 48
Message vs. Envelope


Consider the following SMTP client directives
1. MAIL FROM: <costa@elet.polimi.it>
2. RCPT TO: <costa@cs.vu.nl>




      Paolo Costa            07 - Application Layer   Electronic Mail   23 / 48
Message vs. Envelope


Consider the following SMTP client directives
1. MAIL FROM: <costa@elet.polimi.it>
2. RCPT TO: <costa@cs.vu.nl>
3. From: George W. Bush <president@whitehouse.gov>
   To: Osama <osama@alquaeda.org>
   Subject: warning...

   You can run, but you can’t hide!




      Paolo Costa            07 - Application Layer   Electronic Mail   23 / 48
Message vs. Envelope


Consider the following SMTP client directives
1. MAIL FROM: <costa@elet.polimi.it>
2. RCPT TO: <costa@cs.vu.nl>
3. From: George W. Bush <president@whitehouse.gov>
   To: Osama <osama@alquaeda.org>
   Subject: warning...

   You can run, but you can’t hide!




      Paolo Costa            07 - Application Layer   Electronic Mail   23 / 48
Message vs. Envelope


Consider the following SMTP client directives
1. MAIL FROM: <costa@elet.polimi.it>
2. RCPT TO: <costa@cs.vu.nl>
3. From: George W. Bush <president@whitehouse.gov>
   To: Osama <osama@alquaeda.org>
   Subject: warning...

   You can run, but you can’t hide!

Question
    Anything wrong with this exchange?




      Paolo Costa            07 - Application Layer   Electronic Mail   23 / 48
Message vs. Envelope


Consider the following SMTP client directives
1. MAIL FROM: <costa@elet.polimi.it>
2. RCPT TO: <costa@cs.vu.nl>
3. From: George W. Bush <president@whitehouse.gov>
   To: Osama <osama@alquaeda.org>
   Subject: warning...

   You can run, but you can’t hide!

Question
    Anything wrong with this exchange?




      Paolo Costa            07 - Application Layer   Electronic Mail   23 / 48
Message vs. Envelope


  The MAIL FROM: and RCPT TO: SMTP messages specify
  envelope addresses
  From: and To: (and Cc:) headers within a message define
  message addresses




    Paolo Costa         07 - Application Layer   Electronic Mail   24 / 48
Message vs. Envelope


  The MAIL FROM: and RCPT TO: SMTP messages specify
  envelope addresses
  From: and To: (and Cc:) headers within a message define
  message addresses
  There are many situations in which it is perfectly legitimate to have
  envelope addresses that don’t match up with the message
  addresses
       a message from a mailing list
       a “blind” copy
       a message to multiple receivers (To: and/or Cc:)
       a forwarded (or re-sent) message




    Paolo Costa             07 - Application Layer        Electronic Mail   24 / 48
Limitations of the Message Format
   The standard message format has some serious limitations
        7-bit (text) content
        only text
        essentially good exclusively for the English language




     Paolo Costa              07 - Application Layer        Electronic Mail   25 / 48
Limitations of the Message Format
   The standard message format has some serious limitations
        7-bit (text) content
        only text
        essentially good exclusively for the English language
   The Multipurpose Internet Mail Extensions (MIME) specification
   (RFC 2045 and RFC 2046) defines useful extensions
                   Text          Plain                unformatted
                                 Richtext             formatted RTF
                   Image         Gif                  GIF still
                                 Jpeg                 JPEG still
                   Audio         Basic
                   Video         Mpeg                 MPEG video
                   Application   Octet-stream         binaries
                                 Postscript           printable doc
                   Message       RFC822               Embedded rfc822 msg
                                 Partial              more to follow
                                 External-body        provide URL
                   Multipart     Mixed                independent parts
                                 Alternative          same in diff. formats
                                 Parallel             view all at once
                                 Digest               set of rfc822s
     Paolo Costa                     07 - Application Layer                   Electronic Mail   25 / 48
POP3

  Problem: a user’s mailbox may be stored on a different machine
  than the user agent. We need remote access to incoming (and
  actually also outgoing) messages
  Solution: use the Post Office Protocol (POP3):




    Paolo Costa           07 - Application Layer     Electronic Mail   26 / 48
POP3

  Problem: a user’s mailbox may be stored on a different machine
  than the user agent. We need remote access to incoming (and
  actually also outgoing) messages
  Solution: use the Post Office Protocol (POP3):




    Paolo Costa           07 - Application Layer     Electronic Mail   26 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client     Server
                               +OK POP3 server ready




      Paolo Costa            07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client           Server
                                     +OK POP3 server ready
                    USER carolyn




      Paolo Costa                  07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client           Server
                                     +OK POP3 server ready
                    USER carolyn
                                     +OK




      Paolo Costa                  07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302
                                        .




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302
                                        .
                    RETR 1




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302
                                        .
                    RETR 1
                                        (sends message 1)




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302
                                        .
                    RETR 1
                                        (sends message 1)
                    DELE 1




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302
                                        .
                    RETR 1
                                        (sends message 1)
                    DELE 1
                    RETR 2




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302
                                        .
                    RETR 1
                                        (sends message 1)
                    DELE 1
                    RETR 2
                                        (sends message 2)




      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302
                                        .
                    RETR 1
                                        (sends message 1)
                    DELE 1
                    RETR 2
                                        (sends message 2)
                    DELE 2



      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302
                                        .
                    RETR 1
                                        (sends message 1)
                    DELE 1
                    RETR 2
                                        (sends message 2)
                    DELE 2
                    QUIT

      Paolo Costa                     07 - Application Layer    Electronic Mail   27 / 48
POP3
Example
    You can try to connect to you ISP’s POP 3 server
          telnet pop3.isp.com 110
                    Client              Server
                                        +OK POP3 server ready
                    USER carolyn
                                        +OK
                    PASS vegetables
                                        +OK login successful
                    LIST
                                        1 2505
                                        2 14302
                                        .
                    RETR 1
                                        (sends message 1)
                    DELE 1
                    RETR 2
                                        (sends message 2)
                    DELE 2
                    QUIT
                                        +OK POP3 server disconnecting
      Paolo Costa                     07 - Application Layer            Electronic Mail   27 / 48
IMAP
  Observation: POP3 (implicitly) assumes that retrieved mail is
  deleted at the server
       not a good idea for people wanting to access mail from different
       computers.




    Paolo Costa              07 - Application Layer        Electronic Mail   28 / 48
IMAP
  Observation: POP3 (implicitly) assumes that retrieved mail is
  deleted at the server
       not a good idea for people wanting to access mail from different
       computers.
  The Internet Message Access Protocol solves this problem.




    Paolo Costa              07 - Application Layer        Electronic Mail   28 / 48
IMAP
  Observation: POP3 (implicitly) assumes that retrieved mail is
  deleted at the server
       not a good idea for people wanting to access mail from different
       computers.
  The Internet Message Access Protocol solves this problem.
                  Feature                             POP3        IMAP
                  Where is e-mail stored              User’s PC   Server
                  Where is e-mail read                Off-line    On-line
                  Connect time required               Little      Much
                  Use of server resources             Minimal     Extensive
                  Multiple mailboxes                  No          Yes
                  Who backs up mailboxes              User        ISP
                  Good for mobile users               No          Yes
                  User control over downloading       Little      Great
                  Partial message downloads           No          Yes
                  Are disk quotas a problem           No          Could be in time
                  Simple to implement                 Yes         No
                  Widespread support                  Yes         Growing

    Paolo Costa                      07 - Application Layer                 Electronic Mail   28 / 48
World Wide Web

  Basic model: Users and organizations maintain pages of
  information that contain references to each other as hyperlinks
  Selecting a link has the effect of pulling in the referenced page
       The client has a Web browser that can display Web pages.
              web pages are formatted in a special markup language which is
              interpreted by the browser
              this allows for fancy typefonts and the like.
       A hyperlink identifies a (remote) Web server that has access to the
       referred Web page
              when selecting a link, the browser establishes a TCP connection to
              the server, and the page is transferred to the user.
       A Web server listens for connection requests, accepts one request,
       returns the page over the connection, and closes it again
              a connected client and server speak HTTP (HyperText Transfer
              Protocol).



    Paolo Costa                 07 - Application Layer                 WWW     29 / 48
World Wide Web
Client/Server Interaction




     When a client receives a new Web page, it can access other
     servers through the links contained in that new page.
     Each special feature in a page (i.e. in-line images) is transferred
     separately after the page has been copied to the client



        Paolo Costa            07 - Application Layer           WWW    30 / 48
World Wide Web
Client/Server Interaction




     When a client receives a new Web page, it can access other
     servers through the links contained in that new page.
     Each special feature in a page (i.e. in-line images) is transferred
     separately after the page has been copied to the client
           this also means establishing and releasing several connections to
           the original server

        Paolo Costa              07 - Application Layer             WWW   30 / 48
World Wide Web
Client/Server Interaction




     When a client receives a new Web page, it can access other
     servers through the links contained in that new page.
     Each special feature in a page (i.e. in-line images) is transferred
     separately after the page has been copied to the client
        this also means establishing and releasing several connections to
        the original server
      ⇒ HTTP 1.1 allows for reusing persistent TCP connections
        Paolo Costa            07 - Application Layer            WWW    30 / 48
Web Servers
  Problem: Most servers need to process many incoming requests




    Paolo Costa          07 - Application Layer       WWW   31 / 48
Web Servers
  Problem: Most servers need to process many incoming requests
  Solution: An often applied design is to use multithreaded servers




    Paolo Costa            07 - Application Layer          WWW   31 / 48
Web Servers
  Problem: Most servers need to process many incoming requests
  Solution: An often applied design is to use multithreaded servers




    Paolo Costa            07 - Application Layer          WWW   31 / 48
Web Servers
  Problem: Most servers need to process many incoming requests
  Solution: An often applied design is to use multithreaded servers




  If too many requests come in each second, the CPU will not be
  able to handle the processing load ⇒ use server farms




    Paolo Costa            07 - Application Layer          WWW    31 / 48
Web Servers
  Problem: Most servers need to process many incoming requests
  Solution: An often applied design is to use multithreaded servers




  If too many requests come in each second, the CPU will not be
  able to handle the processing load ⇒ use server farms
       a front end still accepts incoming requests but sprays them over
       multiple CPUs rather than multiple threads




    Paolo Costa              07 - Application Layer             WWW       31 / 48
Uniform Resource Locators (URL)
  A URL contains three informative parts
   (1) the name of a page
   (2) the name of its location
   (3) the access protocol




    Paolo Costa              07 - Application Layer   WWW   32 / 48
Uniform Resource Locators (URL)
  A URL contains three informative parts
   (1) the name of a page
   (2) the name of its location
   (3) the access protocol
        Name      Usage             Example
        http      Hypertext         http://www.cs.vu.nl/~costa/cn/
        ftp       File transfer     ftp://ftp.cs.vu.nl/pub/minix/README
        file       Local file         file:/home/costa/www/cn/index.html
        news      News group        news:comp.os.minix
        news      News article      news:AA0134223112@cs.utah.edu
        gopher    Gopher            gopher://gopher.tc.umn.edu/11/Libs
        mailto    Sending email     mailto:kim@acm.org
        telnet    Remote login      telnet://www.w3.org:80




    Paolo Costa                   07 - Application Layer           WWW    32 / 48
Uniform Resource Locators (URL)
  A URL contains three informative parts
   (1) the name of a page
   (2) the name of its location
   (3) the access protocol
        Name      Usage             Example
        http      Hypertext         http://www.cs.vu.nl/~costa/cn/
        ftp       File transfer     ftp://ftp.cs.vu.nl/pub/minix/README
        file       Local file         file:/home/costa/www/cn/index.html
        news      News group        news:comp.os.minix
        news      News article      news:AA0134223112@cs.utah.edu
        gopher    Gopher            gopher://gopher.tc.umn.edu/11/Libs
        mailto    Sending email     mailto:kim@acm.org
        telnet    Remote login      telnet://www.w3.org:80
  Disadvantage: URLs contain location information
       they refer to the location where a page is found.
       this makes it much harder to move/replicate pages around




    Paolo Costa                   07 - Application Layer           WWW    32 / 48
Uniform Resource Locators (URL)
  A URL contains three informative parts
   (1) the name of a page
   (2) the name of its location
   (3) the access protocol
        Name      Usage             Example
        http      Hypertext         http://www.cs.vu.nl/~costa/cn/
        ftp       File transfer     ftp://ftp.cs.vu.nl/pub/minix/README
        file       Local file         file:/home/costa/www/cn/index.html
        news      News group        news:comp.os.minix
        news      News article      news:AA0134223112@cs.utah.edu
        gopher    Gopher            gopher://gopher.tc.umn.edu/11/Libs
        mailto    Sending email     mailto:kim@acm.org
        telnet    Remote login      telnet://www.w3.org:80
  Disadvantage: URLs contain location information
       they refer to the location where a page is found.
       this makes it much harder to move/replicate pages around
  In both cases, you don’t care where the page is, but just that it has
  a worldwide unique name
       IETF is working on a system of URNs (Universal Resource Names)
       to generalize URLs
    Paolo Costa                   07 - Application Layer           WWW    32 / 48
HTTP
Overview
    Communication in the Web is generally based on the HyperText
    Transfer Protocol
    Uses a connection-oriented transport mechanism (i.e., TCP)
           although it can also work on UDP
    Consists of a sequence of requests issued by the client, and
    responses issued by the server, each one in response to a single
    request




      Paolo Costa               07 - Application Layer      WWW   33 / 48
HTTP
Overview
    Communication in the Web is generally based on the HyperText
    Transfer Protocol
    Uses a connection-oriented transport mechanism (i.e., TCP)
           although it can also work on UDP
    Consists of a sequence of requests issued by the client, and
    responses issued by the server, each one in response to a single
    request
    HTTP is stateless
           the behavior of a request does not depend on previous requests




      Paolo Costa               07 - Application Layer            WWW       33 / 48
HTTP
Overview
    Communication in the Web is generally based on the HyperText
    Transfer Protocol
    Uses a connection-oriented transport mechanism (i.e., TCP)
           although it can also work on UDP
    Consists of a sequence of requests issued by the client, and
    responses issued by the server, each one in response to a single
    request
    HTTP is stateless
           the behavior of a request does not depend on previous requests
    Request...


 GET /~costa/index.php HTTP/1.1
 Host: www.cs.vu.nl
 Connection: close
 User-agent: Mozilla/4.0
 Accept-Language: it




       Paolo Costa                07 - Application Layer          WWW       33 / 48
HTTP
Overview
    Communication in the Web is generally based on the HyperText
    Transfer Protocol
    Uses a connection-oriented transport mechanism (i.e., TCP)
           although it can also work on UDP
    Consists of a sequence of requests issued by the client, and
    responses issued by the server, each one in response to a single
    request
    HTTP is stateless
           the behavior of a request does not depend on previous requests
    Request...and reply

                                       HTTP/1.1 200 OK
                                       Connection: close
 GET /~costa/index.php HTTP/1.1        Date: Wed, 18 Jun 2008 14:00:01 GMT
 Host: www.cs.vu.nl                    Server: Apache/1.3.0 (Unix)
 Connection: close                     Last-Modified: Tue, 17 Jun 2008 16:44:00 GMT
 User-agent: Mozilla/4.0               Content-Length: 2557
 Accept-Language: it                   Content-Type: text/html

                                       <!DOCTYPE HTML PUBLIC "-/W3C//DTD HTML 4.01//EN"
                                       ...

       Paolo Costa                07 - Application Layer                      WWW     33 / 48
HTTP
Overview
    Communication in the Web is generally based on the HyperText
    Transfer Protocol
    Uses a connection-oriented transport mechanism (i.e., TCP)
           although it can also work on UDP
    Consists of a sequence of requests issued by the client, and
    responses issued by the server, each one in response to a single
    request
    HTTP is stateless
           the behavior of a request does not depend on previous requests
    Request...and reply
           try yourself: telnet www.cs.vu.nl 80
                                       HTTP/1.1 200 OK
                                       Connection: close
 GET /~costa/index.php HTTP/1.1        Date: Wed, 18 Jun 2008 14:00:01 GMT
 Host: www.cs.vu.nl                    Server: Apache/1.3.0 (Unix)
 Connection: close                     Last-Modified: Tue, 17 Jun 2008 16:44:00 GMT
 User-agent: Mozilla/4.0               Content-Length: 2557
 Accept-Language: it                   Content-Type: text/html

                                       <!DOCTYPE HTML PUBLIC "-/W3C//DTD HTML 4.01//EN"
                                       ...

       Paolo Costa                07 - Application Layer                      WWW     33 / 48
HTTP
Requests




    HTTP supports the following request messages:
            Operation   Description
            Head        Request to return the header of a document
            Get         Request to return a document to the client
            Put         Request to store a document
            Post        Provide data that are to be added to a document (collection)
            Delete      Request to delete a document




      Paolo Costa                   07 - Application Layer                      WWW    34 / 48
HTTP
Header
       The request line (e.g., the line with the GET method) may be
       followed by additional lines with more information:
Header                   C/S   Contents
Accept                   C     The type of documents the client can handle
Accept-Charset           C     The character sets are acceptable for the client
Accept-Encoding          C     The document encodings the client can handle
Accept-Language          C     The natural language the client can handle
Authorization            C     A list of the client’s credentials
Date                     C+S   Date and time the message was sent
ETag                     S     The tags associated with the returned document
Expires                  S     The time for how long the response remains valid
From                     C     The client’s e-mail address
Host                     C     The server’s DNS name
If-Match                 C     The tags the document should have
If-None-Match            C     The tags the document should not have
If-Modified-Since         C     Tells the server to return a document only if it has been modified since the specified time
If-Unmodified-Since       C     Tells the server to return a document only if it has not been modified since the specified time
Last-Modified             S     The time the returned document was last modified
Location                 S     A document reference to which the client should redirect its request
Referer                  C     Refers to client’s most recently requested document
Upgrade                  C+S   The application protocol sender wants to switch to
Warning                  C+S   Information about status of the data in the message
           Paolo Costa                            07 - Application Layer                                    WWW        35 / 48
Cookies
  Problem: The Web is stateless: servers do not keep track of their
  clients.
       this may be (mis)useful in many cases
       e.g., how do you implement a “shopping cart” ?




    Paolo Costa             07 - Application Layer         WWW   36 / 48
Cookies
  Problem: The Web is stateless: servers do not keep track of their
  clients.
       this may be (mis)useful in many cases
       e.g., how do you implement a “shopping cart” ?
  Solution: drop a cookie at the client side containing server state
  relevant for that client
       when a browser contacts a server, a related cookie is sent to the
       server, after which a page can be displayed relevant to that
       cookie/client.
                  Domain               Content
                  toms-casino.com      CustomerID=497793521
                  joes-store.com       Cart=1-00501;1-07031;2-13721
                  aportal.com          Prefs=Stk;SUNW+ORCL;Spt:Jets
                  sneaky.com           UserID=3627239101




    Paolo Costa                    07 - Application Layer             WWW   36 / 48
Cookies
  Problem: The Web is stateless: servers do not keep track of their
  clients.
       this may be (mis)useful in many cases
       e.g., how do you implement a “shopping cart” ?
  Solution: drop a cookie at the client side containing server state
  relevant for that client
       when a browser contacts a server, a related cookie is sent to the
       server, after which a page can be displayed relevant to that
       cookie/client.
                  Domain               Content
                  toms-casino.com      CustomerID=497793521
                  joes-store.com       Cart=1-00501;1-07031;2-13721
                  aportal.com          Prefs=Stk;SUNW+ORCL;Spt:Jets
                  sneaky.com           UserID=3627239101
  There is also an Expires field
  The Secure field indicates that a cookie may be returned only to a
  secure server.
    Paolo Costa                    07 - Application Layer             WWW   36 / 48
Example




      web                                  web
    browser                               server
    hispeed.nl                            blah.com




   Paolo Costa   07 - Application Layer         WWW   37 / 48
Example




                 GET / HTTP/1.1
                 Host: blah.com
                 ...
      web                                    web
    browser                                 server
    hispeed.nl                              blah.com




   Paolo Costa     07 - Application Layer         WWW   37 / 48
Example




                 GET / HTTP/1.1
                 Host: blah.com
                 ...
      web                                      web
    browser                                   server
    hispeed.nl                               blah.com

                                            Session 687876




   Paolo Costa     07 - Application Layer           WWW      37 / 48
Example




      web                                              web
    browser                                           server
    hispeed.nl                                       blah.com
                 HTTP/1.1 200 OK
                 Set-Cookie: 687876                 Session 687876
                 ...
                 <html><head>. . . </head><body>
                 <a href="let-zeppelin">Buy</a>
                 <a href="deep-purple">Buy</a>
                 ...
   Paolo Costa             07 - Application Layer           WWW      37 / 48
Example




       web                                              web
     browser                                           server
    hispeed.nl                                        blah.com
               HTTP/1.1 200 OK
blah.com: 687876
               Set-Cookie: 687876                    Session 687876
               ...
                  <html><head>. . . </head><body>
                  <a href="let-zeppelin">Buy</a>
                  <a href="deep-purple">Buy</a>
                  ...
    Paolo Costa             07 - Application Layer           WWW      37 / 48
Example




        web                                    web
      browser                                 server
     hispeed.nl                              blah.com

blah.com: 687876                            Session 687876




     Paolo Costa   07 - Application Layer           WWW      37 / 48
Example



                   GET /led-zeppelin HTTP/1.1
                   Host: blah.com
                   Cookie: 687876
                   ...
        web                                            web
      browser                                         server
     hispeed.nl                                      blah.com

blah.com: 687876                                    Session 687876




     Paolo Costa           07 - Application Layer           WWW      37 / 48
Example




        web                                    web
      browser                                 server
     hispeed.nl                              blah.com

blah.com: 687876                            Session 687876
                                            Led Zeppelin




     Paolo Costa   07 - Application Layer           WWW      37 / 48
Example




       web                                            web
     browser                                         server
     hispeed.nl                                      blah.com
                 HTTP/1.1 200 OK
blah.com: 687876 . . .                            Session 687876
                  <html><head>. . . </head><body> Led Zeppelin
                  <a href="cream">Buy</a>
                  <a href="beatles">Buy</a>
                  ...

    Paolo Costa             07 - Application Layer         WWW     37 / 48
Example




        web                                    web
      browser                                 server
     hispeed.nl                              blah.com

blah.com: 687876                            Session 687876
                                            Led Zeppelin




     Paolo Costa   07 - Application Layer           WWW      37 / 48
Example



                   GET /cream HTTP/1.1
                   Host: blah.com
                   Cookie: 687876
                   ...
        web                                         web
      browser                                      server
     hispeed.nl                                   blah.com

blah.com: 687876                                 Session 687876
                                                 Led Zeppelin




     Paolo Costa        07 - Application Layer           WWW      37 / 48
Example




        web                                    web
      browser                                 server
     hispeed.nl                              blah.com

blah.com: 687876                            Session 687876
                                            Led Zeppelin
                                            Cream




     Paolo Costa   07 - Application Layer           WWW      37 / 48
Example




       web                                            web
     browser                                         server
     hispeed.nl                                      blah.com
                 HTTP/1.1 200 OK
blah.com: 687876 . . .                            Session 687876
                  <html><head>. . . </head><body> Led Zeppelin
                  <a href="abba">Buy</a>          Cream
                  <a href="ac-dc">Buy</a>
                  ...


    Paolo Costa             07 - Application Layer         WWW     37 / 48
Example




        web                                    web
      browser                                 server
     hispeed.nl                              blah.com

blah.com: 687876                            Session 687876
                                            Led Zeppelin
                                            Cream




     Paolo Costa   07 - Application Layer           WWW      37 / 48
Example



                   GET /end-session HTTP/1.1
                   Host: blah.com
                   Cookie: 687876
                   ...
        web                                            web
      browser                                         server
     hispeed.nl                                      blah.com

blah.com: 687876                                    Session 687876
                                                    Led Zeppelin
                                                    Cream




     Paolo Costa           07 - Application Layer           WWW      37 / 48
Example




        web                                    web
      browser                                 server
     hispeed.nl                              blah.com

blah.com: 687876                            Session 687876
                                            Led Zeppelin
                                            Cream




     Paolo Costa   07 - Application Layer           WWW      37 / 48
Example




       web                                              web
     browser                                           server
    hispeed.nl                                        blah.com
                 HTTP/1.1 200 OK
blah.com: 687876 Set-Cookie: END                     Session 687876
                 ...                                 Led Zeppelin
                                                     Cream
                  <html><head>. . . </head><body>
                  Thank you!
                  ...

    Paolo Costa             07 - Application Layer           WWW      37 / 48
Example




       web                                    web
     browser                                 server
     hispeed.nl                             blah.com

  blah.com: END                            Session 687876
                                           Led Zeppelin
                                           Cream




    Paolo Costa   07 - Application Layer           WWW      37 / 48
Dynamic Web Pages
  Essence: Instead of storing and returning statically defined Web
  pages, servers often generate pages on-the-fly:




    Paolo Costa           07 - Application Layer          WWW   38 / 48
Dynamic Web Pages
  Essence: Instead of storing and returning statically defined Web
  pages, servers often generate pages on-the-fly:




  Common Gateway Interface: CGI essentially allows you to identify
  a program and its parameters in a URL.
       The server will start a process to execute that program, which, in
       turn, will return its results (if any) as a regular Web page




    Paolo Costa              07 - Application Layer              WWW    38 / 48
Dynamic Web Pages
  Essence: Instead of storing and returning statically defined Web
  pages, servers often generate pages on-the-fly:




  Common Gateway Interface: CGI essentially allows you to identify
  a program and its parameters in a URL.
       The server will start a process to execute that program, which, in
       turn, will return its results (if any) as a regular Web page
                  #/bin/sh
                  echo Content-Type: text/html
                  echo
                  echo "<html><head><title>$QUERY_STRING</title><head>"
                  echo "<body><h1>A host interface</h1><pre>"
                  /usr/bin/host "$QUERY_STRING"
                  echo "</pre></body></html>"




    Paolo Costa                  07 - Application Layer                   WWW   38 / 48
Dynamic Web Pages
  Essence: Instead of storing and returning statically defined Web
  pages, servers often generate pages on-the-fly:




  Common Gateway Interface: CGI essentially allows you to identify
  a program and its parameters in a URL.
       The server will start a process to execute that program, which, in
       turn, will return its results (if any) as a regular Web page
                  #/bin/sh
                  echo Content-Type: text/html
                  echo
                  echo "<html><head><title>$QUERY_STRING</title><head>"
                  echo "<body><h1>A host interface</h1><pre>"
                  /usr/bin/host "$QUERY_STRING"
                  echo "</pre></body></html>"


  Servlet are the Java-based solution
       the webserver contains an instance of the Java virtual machine
       they can maintain state (CGI is stateless)
    Paolo Costa                  07 - Application Layer                   WWW   38 / 48
Scripting and Web Pages
  Alternative approach: Let Web pages incorporate interpretable
  code; when a page is being processed, the embedded script is
  simply executed.
  Distinguish server-side (a) and client-side solutions (b):




    Paolo Costa           07 - Application Layer         WWW      39 / 48
Scripting and Web Pages
  Alternative approach: Let Web pages incorporate interpretable
  code; when a page is being processed, the embedded script is
  simply executed.
  Distinguish server-side (a) and client-side solutions (b):




       e.g.,Server-side: PHP: Hypertext Preprocessor (PHP)
                     <html>
                     <head><title>PHP Test</title></head>
                     <body><? print("Hello, World!"); ?></body>
                     </html>




    Paolo Costa             07 - Application Layer                WWW   39 / 48
Scripting and Web Pages
  Alternative approach: Let Web pages incorporate interpretable
  code; when a page is being processed, the embedded script is
  simply executed.
  Distinguish server-side (a) and client-side solutions (b):




       e.g.,Server-side: PHP: Hypertext Preprocessor (PHP)
                       <html>
                       <head><title>PHP Test</title></head>
                       <body><? print("Hello, World!"); ?></body>
                       </html>


       e.g., Client-side JavaScript
                            <html><body>
                            <script language=javascript>
                            document.write("Hello World!");
                            </script>
                            </body></html>

    Paolo Costa               07 - Application Layer                WWW   39 / 48
WWW
Proxy Servers

    Original idea: It is also possible to transfer information referenced
    by a different transfer protocol (notably FTP).
          if the browser does not speak that protocol, a proxy was used.




       Paolo Costa              07 - Application Layer             WWW     40 / 48
WWW
Proxy Servers

    Original idea: It is also possible to transfer information referenced
    by a different transfer protocol (notably FTP).
          if the browser does not speak that protocol, a proxy was used.
    Now: Proxies are mainly used to enhance Web performance by
    caching responses.
          the proxy cache simply keeps previously requested pages and
          returns them on the next request.




    Caching can occur both on client-side and server side


       Paolo Costa              07 - Application Layer             WWW     40 / 48
WWW
Proxy Servers

    Original idea: It is also possible to transfer information referenced
    by a different transfer protocol (notably FTP).
          if the browser does not speak that protocol, a proxy was used.
    Now: Proxies are mainly used to enhance Web performance by
    caching responses.
          the proxy cache simply keeps previously requested pages and
          returns them on the next request.




    Caching can occur both on client-side and server side
    Issue: not very useful nowadays with so much dynamic content
          on the other hand, we have more and more available bandwidth
       Paolo Costa              07 - Application Layer             WWW     40 / 48
Content Delivery Networks

  Basic idea: Install a bunch of servers across the Internet and
  simply replicate Web pages on those servers.
       be sure to redirect clients to the nearest replica server
       it exploits the Location header to redirect clients




    Paolo Costa               07 - Application Layer               WWW   41 / 48
Content Delivery Networks

  Basic idea: Install a bunch of servers across the Internet and
  simply replicate Web pages on those servers.
       be sure to redirect clients to the nearest replica server
       it exploits the Location header to redirect clients




  Example:
       looking up www.furry-video.com which is a page containing
       references to replicated web pages (identified as
       http://cdn-server.com/...)

    Paolo Costa               07 - Application Layer               WWW   41 / 48
Multimedia
  Problem: The Internet is by-and-large turning partly into an
  infrastructure for broadcasting multimedia streams.
       streams consist of packets containing samples of audio and video,
       possibly augmented with data (such as used for subtitles or
       meta-information).




    Paolo Costa             07 - Application Layer          Multimedia   42 / 48
Multimedia
  Problem: The Internet is by-and-large turning partly into an
  infrastructure for broadcasting multimedia streams.
       streams consist of packets containing samples of audio and video,
       possibly augmented with data (such as used for subtitles or
       meta-information).
  Streaming audio: The simplest way to handle this type of
  streaming:




    Paolo Costa             07 - Application Layer          Multimedia   42 / 48
Multimedia
  Problem: The Internet is by-and-large turning partly into an
  infrastructure for broadcasting multimedia streams.
       streams consist of packets containing samples of audio and video,
       possibly augmented with data (such as used for subtitles or
       meta-information).
  Streaming audio: The simplest way to handle this type of
  streaming:




  Issue: There’s no real streaming
       instead a (potentially very large) file is sent to the client for playback
       the user may have to wait for hours (e.g., a movie) before playing it
    Paolo Costa                07 - Application Layer             Multimedia   42 / 48
Real Time Streaming Protocol
  Better solution: Let the browser start an media player application
  that sets up a connection to the server, which in turn starts
  streaming packets to the player.
       we are using RTP on top of UDP.
       To reduce jitter, buffers are used:




  Push Server
    1. the server just pumps out data until the buffer is filled to the
       high-water mark.




    Paolo Costa               07 - Application Layer             Multimedia   43 / 48
Real Time Streaming Protocol
  Better solution: Let the browser start an media player application
  that sets up a connection to the server, which in turn starts
  streaming packets to the player.
       we are using RTP on top of UDP.
       To reduce jitter, buffers are used:




  Push Server
    1. the server just pumps out data until the buffer is filled to the
       high-water mark.
    2. Then the media player tells it to pause and start playing




    Paolo Costa               07 - Application Layer             Multimedia   43 / 48
Real Time Streaming Protocol
  Better solution: Let the browser start an media player application
  that sets up a connection to the server, which in turn starts
  streaming packets to the player.
       we are using RTP on top of UDP.
       To reduce jitter, buffers are used:




  Push Server
    1. the server just pumps out data until the buffer is filled to the
       high-water mark.
    2. Then the media player tells it to pause and start playing
    3. When the buffer hits the low-water mark, the media player tells the
       media server to start again.




    Paolo Costa               07 - Application Layer          Multimedia   43 / 48
Real Time Streaming Protocol
  Better solution: Let the browser start an media player application
  that sets up a connection to the server, which in turn starts
  streaming packets to the player.
       we are using RTP on top of UDP.
       To reduce jitter, buffers are used:




  Push Server
    1. the server just pumps out data until the buffer is filled to the
       high-water mark.
    2. Then the media player tells it to pause and start playing
    3. When the buffer hits the low-water mark, the media player tells the
       media server to start again.




    Paolo Costa               07 - Application Layer          Multimedia   43 / 48
Real Time Streaming Protocol
  Better solution: Let the browser start an media player application
  that sets up a connection to the server, which in turn starts
  streaming packets to the player.
       we are using RTP on top of UDP.
       To reduce jitter, buffers are used:




  Push Server
    1. the server just pumps out data until the buffer is filled to the
       high-water mark.
    2. Then the media player tells it to pause and start playing
    3. When the buffer hits the low-water mark, the media player tells the
       media server to start again.
                        Command       Description
                        DESCRIBE      List media parameters
                        SETUP         Establish channel
                        PLAY          Start sending data to client
                        RECORD        Start accepting data from client
                        PAUSE         Temporarily stop sending data
                        TEARDOWN      Release channel

    Paolo Costa               07 - Application Layer                     Multimedia   43 / 48
Voice over IP

   Essence: Instead of using traditional circuit-switching technology,
   it may pay off to send digitized voice over a packet-switching
   network.
   Two groups defined a standard.
        ITU (the telcos) invented H.323.
               It’s big, as all other ITU protocols are.
        The IETF invented SIP
               It’s simpler, like most IETF protocols.
   Session Initiation Protocol (SIP)
        It deals only with setup, management, and termination of sessions.
        The data transport should use other protocols like RTP.




     Paolo Costa                    07 - Application Layer    Multimedia   44 / 48
Voice over IP

   Essence: Instead of using traditional circuit-switching technology,
   it may pay off to send digitized voice over a packet-switching
   network.
   Two groups defined a standard.
        ITU (the telcos) invented H.323.
               It’s big, as all other ITU protocols are.
        The IETF invented SIP
               It’s simpler, like most IETF protocols.
   Session Initiation Protocol (SIP)
        It deals only with setup, management, and termination of sessions.
        The data transport should use other protocols like RTP.
        SIP is text-based and runs on UDP as well as TCP.
        Users are addressed through, for example, telephone URLs
               e.g., sip:paolo@cs.vu.nl




     Paolo Costa                    07 - Application Layer    Multimedia   44 / 48
Voice over IP

   Essence: Instead of using traditional circuit-switching technology,
   it may pay off to send digitized voice over a packet-switching
   network.
   Two groups defined a standard.
        ITU (the telcos) invented H.323.
               It’s big, as all other ITU protocols are.
        The IETF invented SIP
               It’s simpler, like most IETF protocols.
   Session Initiation Protocol (SIP)
        It deals only with setup, management, and termination of sessions.
        The data transport should use other protocols like RTP.
        SIP is text-based and runs on UDP as well as TCP.
        Users are addressed through, for example, telephone URLs
               e.g., sip:paolo@cs.vu.nl
   Not all Voice-over-IP services support it
        e.g., Skype doesn’t (a proprietary protocol is used)...
        ... but MSN does !
     Paolo Costa                    07 - Application Layer        Multimedia   44 / 48
SIP
Example




           Method     Description
           INVITE     Request initiation of a session
           ACK        Confirm initiation of session
           BYE        Request termination of session
           OPTIONS    Query a host about capabilities
           CANCEL     Cancel a pending request
           REGISTER   Inform redirection server about current location

      Paolo Costa              07 - Application Layer               Multimedia   45 / 48
Video-on-Demand
  Two models:
   (1) The user can request any video, and stop the incoming stream at
       any time
   (2) The provider broadcasts popular videos, but starts several at short
       intervals (near video on demand).




    Paolo Costa              07 - Application Layer           Multimedia   46 / 48
Video-on-Demand
  Two models:
   (1) The user can request any video, and stop the incoming stream at
       any time
   (2) The provider broadcasts popular videos, but starts several at short
       intervals (near video on demand).




    Paolo Costa              07 - Application Layer           Multimedia   46 / 48
Video-on-Demand
Issues




1. The video server can be pretty hot stuff




         Paolo Costa         07 - Application Layer   Multimedia   47 / 48
Video-on-Demand
Issues




1. The video server can be pretty hot stuff
          it requires a lot of storage, which will include tape archives, optical
          disks (as in a juke box), and arrays of magnetic disks (RAIDs).




         Paolo Costa               07 - Application Layer             Multimedia    47 / 48
Video-on-Demand
Issues




1. The video server can be pretty hot stuff
          it requires a lot of storage, which will include tape archives, optical
          disks (as in a juke box), and arrays of magnetic disks (RAIDs).
2. The client will have a set-top box, which is just a simple computer
   that does the (MPEG) decoding, has an interface to the network,
   and controls the TV set (monitor & remote control).




         Paolo Costa               07 - Application Layer             Multimedia    47 / 48
Video-on-Demand
Issues




1. The video server can be pretty hot stuff
          it requires a lot of storage, which will include tape archives, optical
          disks (as in a juke box), and arrays of magnetic disks (RAIDs).
2. The client will have a set-top box, which is just a simple computer
   that does the (MPEG) decoding, has an interface to the network,
   and controls the TV set (monitor & remote control).
3. How are we ever going to get the bandwidth to our homes (the local
   loop problem) ?




         Paolo Costa               07 - Application Layer             Multimedia    47 / 48
Video-on-Demand
Issues




1. The video server can be pretty hot stuff
          it requires a lot of storage, which will include tape archives, optical
          disks (as in a juke box), and arrays of magnetic disks (RAIDs).
2. The client will have a set-top box, which is just a simple computer
   that does the (MPEG) decoding, has an interface to the network,
   and controls the TV set (monitor & remote control).
3. How are we ever going to get the bandwidth to our homes (the local
   loop problem) ?
          there are so many possible solutions, and all of them cost a lot.




         Paolo Costa               07 - Application Layer             Multimedia    47 / 48
Video-on-Demand
Issues




1. The video server can be pretty hot stuff
          it requires a lot of storage, which will include tape archives, optical
          disks (as in a juke box), and arrays of magnetic disks (RAIDs).
2. The client will have a set-top box, which is just a simple computer
   that does the (MPEG) decoding, has an interface to the network,
   and controls the TV set (monitor & remote control).
3. How are we ever going to get the bandwidth to our homes (the local
   loop problem) ?
          there are so many possible solutions, and all of them cost a lot.
          what we’ll need is a convergence of solutions to standards.




         Paolo Costa               07 - Application Layer             Multimedia    47 / 48
Video-on-Demand
Issues




1. The video server can be pretty hot stuff
          it requires a lot of storage, which will include tape archives, optical
          disks (as in a juke box), and arrays of magnetic disks (RAIDs).
2. The client will have a set-top box, which is just a simple computer
   that does the (MPEG) decoding, has an interface to the network,
   and controls the TV set (monitor & remote control).
3. How are we ever going to get the bandwidth to our homes (the local
   loop problem) ?
          there are so many possible solutions, and all of them cost a lot.
          what we’ll need is a convergence of solutions to standards.
          this means a lot of experimentation in the coming years, much of
          which is already going on (ADSL, Fiber-to-the-house, etc.)




         Paolo Costa               07 - Application Layer             Multimedia    47 / 48
Credits




Many thanks to Maarten van Steen and Antonio Carzaniga for
providing most material for these slides




      Paolo Costa          07 - Application Layer        Credits   48 / 48

				
DOCUMENT INFO
Shared By:
Tags:
Stats:
views:15
posted:8/26/2011
language:Italian
pages:218