0% found this document useful (0 votes)
9 views18 pages

Web Cahing

The document discusses web caching, FTP, and the differences between HTTP and SMTP. It explains how web caches store copies of requested objects to improve response times, while FTP uses two parallel TCP connections for file transfers. Additionally, it outlines the basic operations of POP3 for email retrieval, including its phases and command structure.

Uploaded by

20p0801mccpuc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views18 pages

Web Cahing

The document discusses web caching, FTP, and the differences between HTTP and SMTP. It explains how web caches store copies of requested objects to improve response times, while FTP uses two parallel TCP connections for file transfers. Additionally, it outlines the basic operations of POP3 for email retrieval, including its phases and command structure.

Uploaded by

20p0801mccpuc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

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.

• The Web cache has its own disk


storage and keeps copies of
recently requested objects in
this storage.
requesting the object
http://www.someschool.edu/campus.gif. Here
isconnection
• 1. The browser establishes a TCP whatto the
happens:
Web cache and sends an HTTP request for the
object to the Web cache.

• 2. The Web cache checks to see if it has a copy of the object stored locally. If it does, the Web cache
returns the object within an HTTP response message to the client browser.

• 3. If the Web cache does not have the object, the Web cache opens a TCP connection to the origin
server, that is, to www.someschool.edu. The Web cache then sends an HTTP request for the object
into the cache-to-server TCP connection. After receiving this request, the origin server sends the
object within an HTTP response to the Web cache.

• 4. When the Web cache receives the object, it stores a copy in its local storage and sends a copy,
within an HTTP response message, to the client browser.
The Conditional GET
• An HTTP request message is a so-called conditional GET message if (1) the request
message uses the GET method and (2) the request message includes an If-Modified-
Since: header line.

GET /fruit/kiwi.gif HTTP/1.1


Host: www.exotiquecuisine.com

HTTP/1.1 200 OK
Date: Sat, 8 Oct 2011 15:39:29
Server: Apache/1.3.0 (Unix)
Last-Modified: Wed, 7 Sep 2011 09:23:24
Content-Type: image/gif
(data data data data data ...)
GET /fruit/kiwi.gif HTTP/1.1
Host: www.exotiquecuisine.com
If-modified-since: Wed, 7 Sep 2011 09:23:24

HTTP/1.1 304 Not Modified


Date: Sat, 15 Oct 2011 15:39:29
Server: Apache/1.3.0 (Unix)
(empty entity body)
File Transfer: FTP
• The user first provides the hostname of the remote host, causing the FTP
client process in the local host to establish a TCP connection with the FTP
server process in the remote host.

• The user then provides the user identification and password, which are sent
over the TCP connection as part of FTP commands.

• Once the server has authorized the user, the user copies one or more files
stored in the local file system into the remote file system (or vice versa).
FTP moves files between local and
remote file systems
Control and data connections
HTTP and FTP
• HTTP and FTP are both file transfer protocols.

• The most striking difference is that FTP uses two parallel TCP connections to
transfer a file, a control connection and a data connection.

• The control connection is used for sending control information between the two
hosts—information such as user identification, password, commands to change
remote directory, and commands to “put” and “get” files.

• The data connection is used to actually send a file. Because FTP uses a separate
control connection, FTP is said to send its control information out-of-band.

• HTTP, sends request and response header lines into the same TCP connection that
carries the transferred file itself. For this reason, HTTP is said to send its control
information in-band.
FTP Commands and Replies
• The commands, from client to server, and replies, from server to client, are
sent across the control connection in 7-bit ASCII format.

• Thus, FTP commands are readable by people.

• In order to delineate successive commands, a carriage return and line feed


end each command.

• Each command consists of four uppercase ASCII characters, some with


optional arguments.
Some of the more common commands
are given below:
• USER username: Used to send the user identification to the server.
• PASS password: Used to send the user password to the server.
• LIST: Used to ask the server to send back a list of all the files in the current
remote directory. The list of files is sent over a (new and non-persistent) data
connection rather than the control TCP connection.
• RETR filename: Used to retrieve (that is, get) a file from the current directory
of the remote host. This command causes the remote host to initiate a data
connection and to send the requested file over the data connection.
• STOR filename: Used to store (that is, put) a file into the current directory
• of the remote host.
FTP Replies
• Each command is followed by a reply, sent from server to client.

• The replies are three-digit numbers, with an optional message


following the number.

• This is similar in structure to the status code and phrase in the status
line of the HTTP response message.
Some typical replies, along with their
possible messages, are as follows:
• 331 Username OK, password required
• 125 Data connection already open; transfer starting
• 425 Can’t open data connection
• 452 Error writing file
Comparison of SMTP and HTTP
• Both protocols are used to transfer files from one host to another:
HTTP transfers files (also called objects) from a Web server to a Web
client (typically a browser);

• SMTP transfers files (that is, e-mail messages) from one mail server to
another mail server.

• When transferring the files, both persistent HTTP and SMTP use
persistent connections. Thus, the two protocols have common
characteristics.
• However, there are important differences. First, 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.

• In particular, the TCP connection is initiated by the machine that wants


to receive the file.

• On the other hand, SMTP is primarily a push protocol—the sending mail


server pushes the file to the receiving mail server. In particular, the TCP
connection is initiated by the machine that wants to send the file.
• A second difference, which we alluded to earlier, is that SMTP
requires each message, including the body of each message, to be in
7-bit ASCII format.
• If the message contains characters that are not 7-bit ASCII (for
example, French
• characters with accents) or contains binary data (such as an image
file), then the message has to be encoded into 7-bit ASCII. HTTP data
does not impose this restriction.
• A third important difference concerns how a document consisting of
text and images (along with possibly other media types) is handled.

• HTTP encapsulates each object in its own HTTP response message.


Internet mail places all of the message’s objects into one message.
Mail Message Formats
• POP3
• POP3 is an extremely simple mail access protocol. It is defined in [RFC 1939], which
• is short and quite readable. Because the protocol is so simple, its functionality is

• rather limited. POP3 begins when the user agent (the client) opens a TCP connec-
• tion to the mail server (the server) on port 110. With the TCP connection estab-
• lished, POP3 progresses through three phases: authorization, transaction, and update.

• During the first phase, authorization, the user agent sends a username and a password
• (in the clear) to authenticate the user. During the second phase, transaction, the users
• agent retrieves messages; also during this phase, the user agent can mark messages
• for deletion, remove deletion marks, and obtain mail statistics. The third phase,
• update, occurs after the client has issued the quit command, ending the POP3
• session; at this time, the mail server deletes the messages that were marked for
• deletion.
• In a POP3 transaction, the user agent issues commands, and the server responds
• to each command with a reply. There are two possible responses: +OK (sometimes
• followed by server-to-client data), used by the server to indicate that the previous
• command was fine; and -ERR, used by the server to indicate that something was
• wrong with the previous command.
• The authorization phase has two principal commands: user <username> and
• pass <password>. To illustrate these two commands, we suggest that you Telnet
• directly into a POP3 server, using port 110, and issue these commands. Suppose that
• mailServer is the name of your mail server. You will see something like:

You might also like