1. VELAMMAL ENGINEERING COLLEGE
An Autonomous Institution, Affiliated to Anna University Chennai, & Approved by AICTE Delhi
CS8591 COMPUTER NETWORKS
UNIT V
APPLICATION LAYER
Part I – WWW and HTTP
2. 5.1. World Wide Web
• Web is the repository of documents called web pages
• World Wide Web can be defined in two terms as distributed and linked
• Distributed refers to the extension of the web whereas linking refers to
retrieving of one web page from other
• Linking of web page is achieved by a concept called hypertext
• Hypertext – Linked text documents
5.1.2 Architecture of WWW
• WWW is a distributed client server service.
• Client access server through browser
• Server provided over different web pages called sites
• Web pages can be simple or composite
• Composite web page have links to other web pages.
• Simple web page have no link to other web pages
3. Web Client (Browser)
• Web Client access resources through web browser
• Web browser consists of 3 parts:
– Controller
– Client protocol
– Interpreters
• Controller receives input from input device
• Using interpreter, browser displays the document on to the screen
• Based upon application, it uses the appropriate protocol
Fig: Composite Link
Fig: Browser
4. Web Server
• Collection of web pages stored in a server is called web server.
• Each time a request arrives, the corresponding document is sent to the
client.
• To improve efficiency, servers normally store requested files in a cache in
memory; memory is faster to access than a disk.
• A server can also become more efficient through multithreading or
multiprocessing.
• In this case, a server can answer more than one request at a time.
• Some popular web servers include Apache and Microsoft Internet
Information Server.
5.1.3 Uniform Resource Locator (URL)
• A web page, as a file, needs to have a unique identifier to distinguish it
from other web pages.
• To define a web page, we need three identifiers: host, port, and path
• In addition to this we also need to specify the protocol
5. Example:
• Protocol://host/path (Normal)
• Protocol: //host: port/path (for specific application)
• www:// www.mhh.com/compsci
Protocol:
• It is the abbreviation of client server program that need to access web page
• Example: HTTP
Host:
• It is the IP address of the server or domain name
Port:
• It is a 16-bit integer predefined
Path:
• It identifies location and name of the file in the underlying operating system
Web Documents
• www documents are classified into three categories:
– Static
– Dynamic
– Active
6. Static Documents:
• Fixed size documents created and stored in server
• Client can access only copy of the documents.
• User has no right to change content over the document
• It can be modified by the privileged users
• Example: Document viewed through browser
• Static documents are HTML, XML, XSL, and XHTML for its creation
Dynamic Documents:
• Created by the web server on behalf of the request from user
• Web server runs on application program and creates the document
• Example: Date and time retrieval from server (Date and time are dynamic
information)
• Dynamic documents are JSP, ASP, Cold fusion with SQL
Active Documents:
• Programs that run on client site are called active documents
• Example: Run a program that interacts with the user (Graphics)
• Active documents use Java Applets
7. 5.2 Hyper Text Transfer Protocol (HTTP)
• It is the protocol used to retrieve specific web page from the web
• HTTP client sends request, HTTP server returns a response
• Well-known port number of HTTP at server side is 80
• Since HTTP use TCP, it is connection oriented and reliable protocol
• The requested web pages can be located at different server.
• So different methods must be employed to retrieve each object using TCP
connection
• There are two types of connections involved in this operation:
– Non persistent connection
– Persistent connection
Non Persistent Connection:
• In this strategy, one TCP connection is needed for each request and
response.
• It works as follows:
– Client opens TCP connection, sends request
– Server response and close connection
– Client reads until eof and close connection
8. • If there is need to access ‘n’ locations in same server then the connection
must be n+1 times need to be open and close and results in high overhead.
• N+1 buffers are needed during each connection open
Persistent Connections
• It is the default connection by HTTP
• Server response and leaves connection open for more request
• Server close by response from client or if time out has been reached
• Only single set of buffer is needed to be set for the connection at each side
• Documents are created dynamically (actively) in case of persistent
connections
Message Formats
• Each request and response message are made up of four sections
• First message in request message is called request line
• First message in response message is called status line
Request Message
• The method field defines the request types
• GET method to send a request
9. • The HEAD method is used when the client needs only some information
about the web page from the server
• The PUT method is the inverse of the GET method; it allows the client to post
a new web page on the server
• The POST method is similar to the PUT method, but it is used to send some
information to the server to be added to the web page or to modify the web
page
• The TRACE method is used for debugging; the client asks the server to echo
back the request to check whether the server is getting the requests
• The DELETE method allows the client to delete a web page on the server if
the client has permission to do so.
• The CONNECT method was originally made as a reserve method; it may be
used by proxy servers.
• The OPTIONS method allows the client to ask about the properties of a web
page
• After the request line, we can have zero or more request header lines
• Each header line sends additional information from the client to the server
12. Response Message
• It consists of
– Status line
– Header line
– Blank line
– Body
• First line in a response message is called status line
• Status code defines status of code. It is of following types
– Range of 100 – informational
– Range of 200 – successful request
– Range of 300 – redirect to another URL
– Range of 400 – error at client site
– Range of 500 – error at server site
Header and its purpose:
• Date – Current date
• Upgrade – Preferred communication protocol
• Server – Information about server
• Location - client to send request to another site
13. • Accept range – server accept requested byte range
• All the other fields are similar to request message
Conditional Request:
• Inclusion of condition in the existing request by client
• Example: Client request server to display web page from certain date and time
Cookies:
• Web needs to store some information about the user choice or activity, this
plays the purpose of cookies
• Cookies are used in the following applications:
• Add to cart option on electronic stores
• Access to registered clients
• Web sites used as portals, where users selects the web pages he wants to see
• Web sites only as advertising agencies
Cookies Creation:
• Whenever server receives request from client, server retrieves client
information such as ID, Name, Visited page and so on
• Server adds these information along with the response sent to client
• When client receives response, browser stores cookie in the cookie directory,
which is stored by the server domain name
14. • When client sends request to the same server, using cookie information,
server identifies the client as an existing client and not the new one
• Cookie never disclose the information to the user nor read by the browser
Web Caching – Proxy Servers
• A proxy server is a computer that maintains the copies of response to recent
request
• If HTTP client sends request to proxy server, it checks for the requested
information in cache.
• If needed response is not in cache, proxy server sends request to the
corresponding server
• All incoming responses are stored in proxy server for future requests from
client
Proxy Server:
• Reduces work load of original server
• Decreased traffic
• Improves latency
• It can act as both server and client
• On receipt of request from client on which it has no response, it acts as client
and sends request to target server
15. • On receipt of response from target server, it acts as server and respond to
the client
Proxy server – location:
• A client computer can acts as proxy server, that holds response to request
invoked by client
• A proxy server can be installed on LAN to reduce traffic
• An ISP with many customers can add proxy server to reduce traffic
Cache Update:
• It maintains for some period of time and includes last modification time of
the information
HTTP Security:
• It returns over SSL (Secure Socket Layer) and provides confidentiality,
client/server authentication and data integrity