25 October 2019
Network(11) -- The Web and HTTP, Email, DNS
by Jerry Zhang
HTTP with Persistent Connections
shortcomings of Non-persistent connections:
- First, a brand-new connection must be established and maintained for each requested object.
- Second, as we just described, each object suffers a delivery delay of two RTTs—one RTT to establish the TCP connection and one RTT to request and receive an object.
With HTTP 1.1 persistent connections, the server leaves the TCP connection open after sending a response.
These requests for objects can be made back-to-back, without waiting for replies to pending requests (pipelining).
Typically, the HTTP server closes a connection when it isn’t used for a certain time (a configurable timeout interval).
HTTP/2 builds on HTTP 1.1 by allowing multiple requests and replies to be interleaved in the same connection, and a mechanism for prioritizing HTTP message requests and replies within this connection.
HTTP Message Format
When a server receives a request with the HEAD method, it responds with an HTTP message but it leaves out the requested object.
The PUT method is also used by applications that need to upload objects to Web servers.
User-Server Interaction: Cookies
- a cookie header line in the HTTP response message;
- a cookie header line in the HTTP request message;
- a cookie file kept on the user’s end system and managed by the user’s browser;
- a back-end database at the Web site.
Web Caching
A Web cache—also called a proxy server—is a network entity that satisfies HTTP requests on the behalf of an origin Web server.
Note that a cache is both a server and a client at the same time.
Typically a Web cache is purchased and installed by an ISP.
Through the use of Content Distribution Networks (CDNs), Web caches are increasingly playing an important role in the Internet.
The Conditional GET
Caching: the copy of an object residing in the cache may be stale.
HTTP has a mechanism that allows a cache to verify that its objects are up to date. This mechanism is called the conditional GET.
- the request message uses the GET method and
- the request message includes an If-Modified-Since: header line.
Electronic Mail in the Internet
user agents, mail servers, and the Simple Mail Transfer Protocol (SMTP).
Alice’s server holds the message in a message queue and attempts to transfer the message later.
SMTP
it restricts the body (not just the headers) of all mail messages to simple 7-bit ASCII.
SMTP does not normally use intermediate mail servers for sending mail, even when the two mail servers are located at opposite ends of the world.
Comparison with HTTP
HTTP is mainly a pull protocol—someone loads information on a Web server and users use HTTP to pull the information from the server at their convenience.
On the other hand, SMTP is primarily a push protocol—the sending mail server pushes the file to the receiving mail server.
SMTP requires each message, including the body of each message, to be in 7-bit ASCII format. encoded into 7-bit ASCII
HTTP encapsulates each object in its own HTTP response message. SMTP places all of the message’s objects into one message.
Post Office Protocol—Version 3 (POP3), Internet Mail Access Protocol (IMAP), and HTTP.
DNS—The Internet’s Directory Service
a directory service that translates hostnames to IP addresses. This is the main task of the Internet’s domain name system (DNS)
The DNS protocol runs over UDP and uses port 53.
DNS adds an additional delay—sometimes substantial—to the Internet applications that use it. The desired IP address is often cached in a “nearby” DNS server.
- Host aliasing. canonical hostname
- Mail server aliasing.
- Load distribution.
Overview of How DNS Works
The problems with a centralized design include:
- A single point of failure.
- Traffic volume.
- Distant centralized database.
- Maintenance.
A Distributed, Hierarchical Database
- Root DNS servers
- Top-level domain (TLD) servers.
- Authoritative DNS servers.
local DNS server
recursive queries and iterative queries
In practice, the queries typically follow the pattern in Figure 2.19: The query from the requesting host to the local DNS server is recursive, and the remaining queries are iterative.
tags: Network