Content
- HTTP- Request/Response
- Comparison
- Web Caches (Proxy Server)
 
- Email Services- Mail Clients & Servers
- Protocols
 
- DNS- Hierarchy of DNS Servers
- Caching
 
HTTP
- Client-server architecture
- TCP as carrier
- Request-response interaction
- Stateless; no information stored between requests
- Pull protocol
Request/Response
- Browser initiates TCP connection to server with port 80
- Exchange HTTP messages between browser and server
- Close connection (HTTP/1.0)
# Request
|Request line \r\n| -> |Request type| |URL| |HTTP version| \r\n
|Header lines \r\n|
|...          \r\n|
|\r\n             |
|Body             |
# Respond
|Status line  \r\n| -> |HTTP version| |Status code| |Status phrase| \r\n
|Header lines \r\n|
|...          \r\n|
|\r\n             |
|Body             |
Comparison
| http/1.0 | http/1.1 | http/2.0 | |
|---|---|---|---|
| Text-based | Text-based | Binary-based | |
| Connection | Non-persistent | Persistent; pipelining or non-pipelining | |
| Time for fetching 3 objects | Non-parallel: 6 RTT + X; parallel: 4 RTT + X | Non-pipelining: 4 RTT + X; pipelining: 3 RTT + X | |
| Response message | 1 response delivered at a time per connection | 1 response delivered at a time per connection | Multiplexing of multiple responses in a single connection (1 connection for parallelism) | 
| Other features | Compressed header; proactively push resources to client | 
Web Caches (Proxy Server)
                              (If-Modified-Since:xxx)
Client ---request--> Proxy -------conditional GET------> Server
       <--response--(cache)<----------response----------
                            (HTTP/1.1 304 Not Modified/
                             HTTP/1.1 200 OK)
                                (Last-Modified:xxx)
Email Services
- Client-server architecture
- TCP as carrier
- Command-response interaction
- Text-based communication
Mail Clients & Servers
- User agent- SMTP to submit outgoing messages to local mail server
- IMAP or POP to retrieve incoming messages stored on mail server
 
- Mail server- MTA: mail transfer agent
- SMTP transfer messages between MTAs
- Mailbox + queue for outgoing messages
 
user agent --> sender's outgoing MTA --> receiver's domain MTA --> user agent
Protocols
- SMTP (Simple Mail Transfer Protocol): PUSH - TCP based; port 25 - MTA client ---command--> MTA server <--response--
- Commands: ASCII text; response: status code & phrase 
- All message content in 7-bit ASCII
 
- Mail access protocol: PULL - POP (Post Office Protocol)- Authorization
- Download
 
- IMAP (Internet Mail Access Protocol)- More features
- Manipulation of stored messages
 
- HTTP- Webmails
 
 
- POP (Post Office Protocol)
SMTP
1. Start connection
    MTA client --TCP connection--> MTA server
2. Server identifies itself
    MTA client <-220 <domain> service ready/421 service not available-- MTA server
3. Client identifies itself
    MTA client --HELO <server>--> MTA server
4. Server accepts identification
    MTA client <-250 OK-- MTA server
5. Client send 1 or more messages to server (one by one)
    // start of envelope
    MAIL FROM: <mail>
    RCPT TO: <recipients>
    DATA
    [headers] // To: xxx\r\nFrom: xxx ...
    [message content]
    . // end of message
    // end of envelope
6. Client quit
    MTA client --QUIT--> MTA server
7. Server initiates "TCP Close"
    MTA client <-221 closing connection-- MTA server
DNS
- Client-server interaction
- UDP as carrier; port 53
- Information stored in distributed DB; implemented by hierarchy of name servers
- Services- IP to name
- Name to IP
- Host aliasing: translate alias name to canonical hostname
- Mail server aliasing: return canonical names of domain mail servers
- Load distribution: a set of IPs for 1 host name
 
Hierarchy of DNS Servers
# Iterative
Client --> Local DNS Server --> Root DNS Server
                            <--
                            --> TLD DNS Server
                            <--
                            --> Authoritative Server
                            <--
# Recursive
Client --> Local DNS Server --> Root DNS Server
                                --> TLD DNS Server
                                    --> Authoritative Server
                                    <--
                                -->
                            <--
- Root DNS server- Known by all local DNS server
- Contacted by local servers if names not resolved locally
 
- TLD (top-level domain) DNS server- com, org, net, edu, etc.
- uk, fr, ca, hk, etc.
 
- Authoritative server- Providing authoritative hostname to IP mappings for organization’s servers e.g. web, mail
- Maintained by organization itself or another service provider
 
- Local DNS server- Or default name server
- Acts as proxy to answer queries or forward queries
 
Caching
Preventing root DNS server to become the bottleneck.
- TTL (time-to-live)- Duration (in sec) allowed to cache the data for name servers
- Tradeoff between performance & consistency
 
- Resource records - RR format: (name, value, type, class, ttl) # Types Type=A: (hostname, IP) Type=NS: (domain, IP of authoritative DNS server) Type=PTR: (arpa address, hostname) Type=CNAME: (alias name, canonical name) Type=MX: (name, name of mailserver)