(Part-2) : Dr. Nirnay Ghosh

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Module 2

(Part-2)
(Application Layer: Protocols - DNS, SMTP, POP, FTP, WWW, HTTP; Network
security - authentication, basics of public key and private key cryptography,
digital signatures and certificates, firewalls.)

Dr. Nirnay Ghosh


Assistant Professor
Department of Computer Science & Technology
IIEST, Shibpur
2/28/2021 Computer Networks (Module 5) 1
HTTP: Message Format
• Request methods: GET, POST, PUT, and Server hostname

DELETE Non-persistent connection


Client browser
• Majority of requests use GET method User language Typical HTTP Request Message
• Used when the browser requests an object,
with the requested object identified in the URL
field (/somedir/page.html)
• POST: used if the user fills out a form (e.g.,
providing search words to a search engine)
• Entity body: empty for GET; used for POST
• HTML often uses the GET method and
include the inputted form data in the
requested URL
• PUT: web publishing tool General Format of an HTTP Request Message
• Used to upload an object to a specific path (directory)
on a specific Web server
• DELETE: allows an user or an application to
delete an object on the Web server
2/28/2021 2
Computer Networks (Module 5)
HTTP Response Format Status line
• Consists of: status line, header lines, entity
body Header lines
• Status code & associated phrase: result of
the request Entity body
• Some of the common status codes and
associated phrases are as follows: Typical HTTP Request Message

• Header lines: fields are self-explanatory


• Entity body: contains the requested object itself
• HEAD (response message): server responds with an HTTP General Format of an HTTP Response Message
message but leaves out the requested object
• Useful for retrieving meta information written in the response
headers
2/28/2021 3
Computer Networks (Module 5)
User-Server Interaction: Cookies
• Cookies allow Web sites to keep track of users
• Web sites need user identification to restrict
access or serve contents
• Four components of cookie technology:
• a cookie header line in the HTTP response
• a cookie header line in the HTTP request
• a cookie file kept in user’s end system and managed by
user’s browser
• a back-end database at the Web site
• The different steps involved are as follows:
• User sends an HTTP request to the Web server
• Server creates an unique identification number Keeping User State with Cookies
• It creates an entry in its backend database, indexed by • User’s browser reads Set-cookie: header and
this identification number appends a line to the special cookie file it
• Server responds to the user’s browser, including in the manages
HTTP response a Set-cookie: header, containing the
identification number • This line includes the hostname of the server
and the identification number in Set-cookie:
2/28/2021 header 4
Computer Networks (Module 5)
User-Server Interaction: Cookies
• For future accesses to the Web site, the
user’s browser consults the cookie file
• Extracts the identification number for this
site
• Puts a cookie header line that includes the
identification number in the HTTP request
• Cookies: enables Web sites to track the web
page access patterns of every user
identified by the unique identifier
• If the user registers himself/herself with the
Keeping User State with Cookies
Web site, then his/her personal information
gets attached to the unique identifier • Drawback:
• Invasion of privacy
• Cookies: creates a user session layer on top • Combination of cookies and user supplied
of stateless HTTP information can reveal sensitive personal
information and can be potentially sold to a
2/28/2021 third party 5
Computer Networks (Module 5)
Web Caching
• Web cache/Proxy server: network entity that
satisfies HTTP requests on the behalf of an
origin Web server
• Has its own disk storage and keeps copies of recently
requested objects in this storage
• A user’s browser can be configured to direct all
HTTP requests to the Web cache
• The different steps involved in Web cache
functioning are as follows:
• The browser establishes a TCP connection to the Clients Requesting Objects through a Web Cache
Web cache
• It sends an HTTP request for an object to the Web • The origin server sends the object within an
cache
HTTP response to the Web cache
• The Web cache checks if it has a local copy of the
object • Web cache stores a copy in its local storage and
• If so, it returns the object within an HTTP response sends the object within an HTTP response
message to the client browser message to the client browser
• If not, it opens a TCP connection to the origin server
and sends an HTTP request for the object into the
cache-to-server TCP connection
2/28/2021 6
Computer Networks (Module 5)
Web Caching
• Web cache: functions both as a server (to the client
browser) and as a client (to the origin server)
• Typically a Web cache is purchased and installed by
an ISP
• Cost is low
• Many caches use public-domain software that runs on
inexpensive PCs
• Example: a university may install a cache on its campus
network and configure all campus browsers to point to
the cache
• Deployment of Web cache renders the following
benefits:
• Substantially reduces the response time for a client Web Cache Reduces the Bottleneck between an Institutional
request Network and the Internet
• Generally, the bottleneck bandwidth between client and origin
server is much less than that between client and Web cache
• Significantly reduces the traffic on an institution’s access • Content Distribution Networks (CDN)
link to the Internet • Created by installing many geographically
• Institution does not have to upgrade bandwidth (an expensive distributed caches throughout the Internet
solution than deploying Web cache)
• Reduces the Web traffic in the Internet as a whole, • Localizes much of the Internet traffic
thereby
2/28/2021improving the performance for all applications
Computer Networks (Module 5)
7
The Conditional GET • Cache forwards the object to the requesting
• Drawback of caching: browser and caches it locally
• Copy of an object residing in the cache may be • Stores the last-modified date along with the
object
stale
• The object may or may not be modified in the
• Object housed in the Web server may have been Web server
modified since the copy was cached
• Later if another browser requests for the
• Conditional GET: mechanism that allows a same object, cache issues a conditional GET
cache to verify that its objects are up-to-date to the Web server - performs the up-to-date
check
• Includes an If-Modified-Since: header
line to perform an up-to-date check
• Suppose the Web cache sends a request
message to the Web server: • The value of the If-modified-since: header line is
exactly equal to the value of the Last-Modified:
header line that was sent by the server
• Conditional GET: directs the Web server to send the
object only if it has been modified since the specified
• Web server sends a response message with the date
requested object to the cache: • If the object is not modified the server will send the
following message

2/28/2021 8
Computer Networks (Module 5)
File Transfer Protocol (FTP)
• FTP: used to transfer files to or from a remote host
• User interacts with FTP through an FTP user agent
• FTP client process (in the localhost): establishes TCP
connection with the FTP server process (in the
remote host) on port number 21
FTP moves files between Local and Remote File Systems
• User provides his/her identification and password
which are sent over the TCP connection as a part of
the FTP command
• Once the server authorizes the user, file transfer to
and from it can take place
• FTP uses two parallel TCP connections for file
transfer between client and server:
Control and Data Connections
• Control connection: used for sending control
information – user identification, password, commands
to change remote directory, and commands to “put”
and “get” files
• Data connection: used to actually send a file
2/28/2021 9
Computer Networks (Module 5)
File Transfer Protocol (FTP)
• On receiving the command for file transfer
over the control connection, the server side • Common FTP commands issued by client:
initiates a TCP connection to the client side
• FTP sends exactly one file over the data
connection and then closes it
• If the user wants to transfer another file at the
same time, a new FTP data connection is
opened
• Control connection remains open throughout
the user session
• FTP separates control and data connections
• The control information it sends is out-of-band (in • Some typical replies from FTP server:
case of HTTP, it is in-band)
• For every user session, FTP server maintains
state information about the user’s: control
connection; current directory
• Tracking state information of each ongoing
user session constraints the total number of
simultaneous sessions
2/28/2021 10
Computer Networks (Module 5)
Electronic Mail in the Internet
• Email: an asynchronous communication medium
• Modern e-mail has many powerful features:
messages with attachments, hyperlinks, HTML-
formatted text, embedded photos
• Three major components of Internet e-mail
system are
• User agent: allows users to read, reply to, forward,
save, and compose messages (e.g., Microsoft
Outlook, Apple Mail, etc.)
• Mail server: core of the e-mail infrastructure –
houses the mailbox of each recipient – manages and
maintains messages that have been sent to the
recipient
• Simple Mail Transfer Protocol (SMTP): principle
application-layer protocol for Internet electronic
mail
• If the recipient’s mail server is down Internet E-mail System
• The message is hold in the message queue hosted
by the sender’s mail server • Typical path followed by a message:
• Transfer attempts are made after every 30 minutes • Sender’s user agent → Sender’s mail server →
(tentative)
• Server removes the message from the queue Recipient’s mail server → Recipient’s mailbox →
(notifying the sender) if transfer attempts fail for Recipient’s user agent
several days
2/28/2021
Computer Networks (Module 5)
11
Simple Mail Transfer Protocol (SMTP)
• Transfer messages from sender’s mail server to
recipient’s mail server
• Does not use any intermediate mail servers
even though the user agents are geographically
dispersed
Message Exchange using SMTP
• Uses reliable transfer service of TCP to deliver
message from sender’s mail server to • SMTP handshaking phase takes place
receiver’s mail server • The client side of SMTP sends sender’s message into
the TCP connection
• Two sides – client side (executes on sender’s • The server side of SMTP receives the message and
mail server) and server side (executes on places it in recipient’s mailbox
recipient’s mail server) • Recipient invokes his user agent to read the message
• Basic operation of SMTP: • SMTP Handshaking Phase
• Client side issues commands: HELO (an abbreviation
• Sender’s user agent send the composed message to for HELLO), MAIL FROM, RCPT TO, DATA, QUIT (to close
her mail sever, where it is placed in a message connection after all messages are sent)
queue • Client side also sends a single isolated period (.) to
• The client side of SMTP opens a persistent TCP indicate the end of message
connection on port 25 at the server side • Server side issues replies to each command – each
reply has a code and some (optional) English language
• Uses the same connection if the sending mail server has explanation
several
2/28/2021messages to send to the receivingComputer
mail server
Networks (Module 5)
12

You might also like