HTTP - Hyper Text Transfer Protocol
HTTP - Hyper Text Transfer Protocol
It has three sections: an initial status line, six header lines, and then the entity
body. The entity body is the meat of the message -- it contains the requested
object itself (represented by data data data data data ...).
status code and associated phrase indicate the
result of the request.
• 200 OK: Request succeeded and the information is
returned in the response.
• 301 Moved Permanently: Requested object has
been permanently moved; new URL is specified in
Location: header of the response message. The client
software will automatically retrieve the new URL.
• 400 Bad Request: A generic error code indicating that
the request could not be understood by the server.
• 404 Not Found: The requested document does not
exist on this server
• 505 HTTP Version Not Supported: The request HTTP
protocol version is not supported by the server.
User-Server Interaction: Authentication and
Cookies
• Authentication: Many sites require users to provide a username and
a password in order to access the documents housed on the server. This
requirement is referred to as authentication. HTTP provides special status
codes and headers to help sites perform authentication.
Suppose a client contacts a Web site for the first time, and this site uses cookies.
The server’s response will include a Set-cookie: header. Often this header line
contains an identification number generated by the Web server.
For example, the header line might be:
Set-cookie: 1678453
When the the HTTP client receives the response message, it sees the Set-cookie:
header and identification number. It then appends a line to a special cookie file
that is stored in the client machine. This line typically includes the host name of
the server and user's associated identification number. .
In subsequent requests to the same server, say one week later, the client includes
a Cookie: request header, and this header line specifies the identification
number for that server. In the current example, the request message includes
the header line:
Cookie: 1678453
In this manner, the server does not know the username of the user, but the server
does know that this user is the same user that made a specific request one
week ago.
The Conditional GET
• By storing previously retrieved objects, Web caching can reduce object-
retrieval delays and diminish the amount of Web traffic sent over
• the Internet. Web caches can reside in a client or in an intermediate network
cache server.
• Although Web caching can reduce user-perceived response times, it
introduces a new problem -- a copy of an object residing in the cache may
be stale. In other words, the object housed in the Web server may have
been modified since the copy was cached at the client.
• Fortunately, HTTP has a mechanism that allows the client to employ
caching while still ensuring that all objects passed to the browser are up-to-
date. This mechanism is called the conditional GET. An HTTP request
message is a so-called conditional GET message if
(i) the request message uses the GET method and (ii) the request message
includes an If-Modified-Since: header line.
File Transfer: FTP
• FTP (File Transfer Protocol) is a protocol for transferring a file from one host
to another host.
In a typical FTP session, the user is sitting in front of one host (the local host) and
wants to transfer files to or from a remote host. In order for the user to access the
remote account, the user must provide a user identification and a password. After
providing this authorization information, the user can transfer files from the local file
system to the remote file system and vice versa.
HTTP and FTP
• both file transfer protocols
• they both run on top of TCP, the Internet's connection-oriented, transport-
layer, reliable data transfer protocol.
• 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.
FTP Commands and Replies
• The commands, from client to server, and replies, from server to client, are
sent across the control TCP connection in 7-bit ASCII format.
Some typical replies, along with their possible messages, are as follows:
Electronic Mail in the Internet
SMTP ( Simple Mail Transfer Protocol)
SMTP is at the heart of Internet electronic mail. SMTP transfers messages from
senders' mail servers to the recipients' mail servers.
it restricts the body (not just the headers) of all mail messages to be in simple
seven-bit ASCII. But today, in the multimedia era, the seven-bit ASCII restriction is
a bit of a pain -- it requires binary multimedia data to be encoded to ASCII before
being sent over SMTP; and it requires the corresponding ASCII message to be
decoded back to binary after SMTP transport.
Let us take a look at an example transcript between client (C) and server (S). The
host name of the client is crepes.fr and the host name of the server is
hamburger.edu. The ASCII text prefaced with C: are exactly the lines the client
sends into its TCP socket; and the ASCII text prefaced with S: are exactly the lines
the server sends into its TCP socket. The following transcript begins as soon as the
TCP connection is established:
S: 220 hamburger.edu
C: HELO crepes.fr
S: 250 Hello crepes.fr, pleased to meet you
C: MAIL FROM: <[email protected]>
S: 250 [email protected]... Sender ok
C: RCPT TO: <[email protected]>
S: 250 [email protected] ... Recipient ok
C: DATA
S: 354 Enter mail, end with "." on a line by itself
C: Do you like ketchup?
C: How about pickles?
C: .
S: 250 Message accepted for delivery
C: QUIT
S: 221 hamburger.edu closing connection
Mail Message Formats and MIME
1.POP3 (Post Office Protocol - Version 3) run at port 110. POP3 progresses
through three phases: authorization, transaction and update.