Application Layer II Flashcards
To understand: • Web services and HTTP • The electronic mail
Web and HTTP
- Hypertext Transfer Protocol (HTTP), web’s application layer
protocol, defined in [v1.0-RFC 1945] and [v1.1-RFC 2616]
and uses port 80. - A web page consists of objects (e.g. HTML file, JPEG image,
Java applet, audio file, …). - The base HTML-file includes several referenced objects,
each object is addressable by a URL
HTTP overview
- HTTP is a client/server protocol.
- The client - typically a browser -
requests, receives
and “displays” Web objects. - The web server sends objects in
response to
requests. The HTTP server is
stateless.
- The client - typically a browser -
- HTTP uses TCP as its underlying transport
protocol. - The HTTP client first initiates a TCP connection
with the server. - Once the connection is established, the browser
and the server processes access TCP through their
socket interfaces. - The client sends HTTP request messages and
receives HTTP response messages. - The server receives request messages and sends
response messages
HTTP connections
- Non-persistent HTTP
- Persistent HTTP
- Non-persistent HTTP
- At most one object is sent over a TCP connection and then
the connection is closed. - Requires multiple connections to download multiple
objects
- Persistent HTTP
- Multiple objects can be sent over single TCP connection.
Persistent HTTP
- The server leaves the connection open after sending the
response message. - Subsequent HTTP messages between the same client/server
are sent over the open connection. - The client sends requests as soon as it encounters a
referenced object. - It can take as little as one RTT for all the referenced objects
User-server state: cookie
- Recall: an HTTP server is stateless.
- But often it is useful that the server keeps session state
information (e.g. identify users to restrict user access or
serve content as a function of the user identity). - HTTP uses cookies for this purpose
An HTTP cookie has four components:
- 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; and - a back-end database at the Web site.
Web caches (proxy server)
- A web cache satisfies HTTP requests on behalf of an origin
Web server. It is both a client (to the original server) and a
server (to the client). - Web caching reduces response time and network traffic
(access link to the Internet). - A web cache stores a copy of a requested object in its local
storage and sends a copy to the client browser. - To avoid stale data, HTTP uses conditional GET manifested
by the If-Modified-Since: and Last-Modified: header
lines.
The electronic mail
The e-mail has three major
components:
* User agents
* Mail servers
* Simple Mail Transfer Protocol (SMTP)
- User agents
- User agents compose, edit, read and save
(outgoing, incoming messages stored on
server) mail messages.
- Mail servers
- Mail servers have a mailbox (incoming
messages), a message queue (outgoing
messages) and an SMTP implementation.
Simple Mail Transfer Protocol (SMTP)
protocol between mail servers to send email
messages
* Client: sending email messages
* Server: receiving email messages
Simple Mail Transfer Protocol
- SMTP uses TCP for reliable e-mail transfer and port 25.
- Normally the sending server connects directly to the
receiving server (direct transfer). - SMTP has three phases of transfer:
- handshaking (greeting)
- transfer of messages
- closure
- Command/Response interaction
- commands: ASCII text
- response: status code and phrase
- Messages must be in 7-bit ASCII
Mail message format
- Mail message format
- Header lines, e.g.
- To:
- From:
- Subject:
different from SMTP MAIL FROM, RCPT TO: commands! - Body: the “message” separated by a bank line (CRLF
Mail access protocols
- SMTP is a push protocol.
- Mail access protocols
- Post Office Protocol version 3 (POP3
- Internet Mail Access Protocol (IMAP)
- HTTP
SMTP
SMTP is a push protocol. The receiver user agent cannot request to
obtain emails from the receiver’s server using SMPT. Obtaining the
messages is a pull operation
- Mail access protocols
transfer messages from the receiver’s mail server
to the recipient’s user agent
- Post Office Protocol version 3 (POP3
POP3 has three phase:
* Authorisation: the user agent sends a username and a password.
* Transaction: the user agent retrieves messages; can mark messages for
deletion, remove deletion marks, and obtain mail statistics.
* Update: after the client has issued the quit command (ending the POP3
session); the mail server deletes the messages that were marked for
deletion.
- Internet Mail Access Protocol (IMAP)
more features, including
manipulation of stored messages on server
HTTP
gmail, Hotmail, Yahoo, etc