Module 2.1: Application Layer - PowerPoint PPT Presentation

About This Presentation
Title:

Module 2.1: Application Layer

Description:

User-agent: Mozilla/4.0. Connection: close. Accept-language:fr ... Post method: Web page often includes form input. Input is uploaded to server in entity body ... – PowerPoint PPT presentation

Number of Views:65
Avg rating:3.0/5.0
Slides: 21
Provided by: ksa6
Category:

less

Transcript and Presenter's Notes

Title: Module 2.1: Application Layer


1
Module 2.1 Application Layer
  • Application-level protocols provide high-level
    services
  • Web and HTTP
  • DNS
  • Electronic mail
  • Remote login
  • FTP
  • telnet
  • SNMP
  • Multimedia - VoIP
  • All of these applications use client-server
    architecture

2
World Wide Web
  • Hypertext model (HTML)
  • Use of hypertext in World Wide Web (WWW)
  • WWW client-server model
  • Use of TCP/IP protocols in WWW
  • Nice tutorials on HTML and HTTP can be found on
    course web source in resources section.

3
Identifying a page
  • Page identified by
  • Protocol used to access page
  • Computer on which page is stored
  • TCP port to access page
  • Pathname of file on server
  • Specific syntax for Uniform Resource Locator
    (URL) protocol//computer_nameport/document_name
  • Protocol can be http, ftp, file, mailto
  • Computer name is DNS name
  • (Optional) port is TCP port
  • document_name is path on computer to page

4
Client Architecture
  • Browser has the following components
  • Display driver for painting screen
  • HTML interpreter for HTML-formatted documents
  • Other interpreters (e.g., Shockwave, JVM, VB
    runtime environment) for other items
  • HTTP client to fetch HTML documents from WWW
    server
  • Other clients for other protocols (e.g., ftp,
    telnet)
  • Controller to accept input from user
  • Must be multi-threaded

5
HTTP overview
  • HTTP hypertext transfer protocol
  • Webs application layer protocol
  • client/server model
  • client browser that requests, receives,
    displays Web objects
  • server Web server sends objects in response to
    requests
  • HTTP 1.0 RFC 1945
  • HTTP 1.1 RFC 2068

HTTP request
PC running Explorer
HTTP response
HTTP request
Server running Apache Web server
HTTP response
Mac running Navigator
6
HTTP overview (continued)
  • Uses TCP (socket programming)
  • Server listens on port 80 or 8080 for accepting
    connections from client
  • client initiates TCP connection (creates socket)
    to server, port 80
  • server accepts TCP connection from client, and
    creates thread to handle accepted connection
  • Connection is established now between client and
    server thread
  • HTTP messages between Client and Server are
    exchanged
  • TCP connection closed
  • Meanwhile server keeps listening for new
    connections
  • HTTP is stateless
  • server maintains no information about past client
    requests, as each request is process
    independently, without knowledge of the old
    requests.
  • Server does not know who the client is?
  • Or is it?

aside
  • We will illustrate this further in TCP layer.

7
Sample HTTP1.0 Exchange
To retrieve the file at the URL
http//www.somehost.com/path/file.html first
open a socket to the host www.somehost.com, port
80 (use the default port of 80 because none is
specified in the URL). Then, send something like
the following through the socket GET
/path/file.html HTTP/1.0 From
someuser_at_jmarshall.com User-Agent HTTPTool/1.0
blank line here The server should respond
with something like the following, sent back
through the same socket HTTP/1.0 200 OK Date
Fri, 31 Dec 1999 235959 GMT Content-Type
text/html Content-Length 1354 lthtmlgt ltbodygt
lth1gtHappy New Millennium!lt/h1gt (more file
contents) . . lt/bodygt lt/htmlgt After sending
the response, the server closes the socket ?
servicing only one request per connection.
8
HTTP request message general format
9
HTTP request message
  • two types of HTTP messages request, response
  • HTTP request message
  • ASCII (human-readable format)

request line (GET, POST, HEAD commands)
GET /somedir/page.html HTTP/1.1 Host
www.someschool.edu User-agent
Mozilla/4.0 Connection close Accept-languagefr
(extra carriage return, line feed)
header lines
Carriage return, line feed indicates end of
message
10
HTTP response message
status line (protocol status code status phrase)
HTTP/1.1 200 OK Connection close Date Thu, 06
Aug 1998 120015 GMT Server Apache/1.3.0
(Unix) Last-Modified Mon, 22 Jun 1998 ...
Content-Length 6821 Content-Type text/html
data data data data data ...
header lines
data, e.g., requested HTML file
11
HTTP connections
  • Nonpersistent HTTP
  • At most one object is sent over a TCP connection.
  • HTTP/1.0 uses nonpersistent HTTP
  • Persistent HTTP
  • Multiple objects can be sent over single TCP
    connection between client and server.
  • HTTP/1.1 uses persistent connections in default
    mode with pipelining.
  • Without pipelining client has to issue one
    request at a time. It can not issue a new
    request until it receives the response of the
    previous one.
  • With pipelining client doesnt have to wait for
    first response. Client can request multiple
    objects.

What is?
  • HTTP Transaction
  • HTTP request and response
  • HTTP Hit
  • For server statistics
  • Server sends one object to client

12
HTTP 1.1 and higher
  • As of early 1997, the Web is moving from HTTP 1.0
    to HTTP 1.1. Whenever practical, use HTTP 1.1.
    It's more efficient overall. WHY?
  • HTTP1.0 Client Request
  • telnet www.ccse.kfupm.edu.sa 80
  • GET http//www.ccse.kfupm.edu.sa/salah/ics432/ind
    ex.html
  • HTTP1.1 Client Request
  • telnet www.ccse.kfupm.edu.sa 80
  • GET http//www.ccse.kfupm.edu.sa/salah/ics432/ind
    ex.html HTTP/1.1
  • Host www.ccse.kfupm.edu.sa80
  • HTTP1.2 Client Request
  • telnet www.ccse.kfupm.edu.sa 80
  • GET http//www.ccse.kfupm.edu.sa/salah/ics432/ind
    ex.html HTTP/1.2
  • No need to have Host field for every request.

13
Uploading form input
  • Post method
  • Web page often includes form input
  • Input is uploaded to server in entity body
  • URL method
  • Uses GET method
  • Input is uploaded in URL field of request line

www.somesite.com/animalsearch?monkeysbanana
14
Method types
  • HTTP/1.0
  • GET
  • POST
  • HEAD
  • asks server to leave requested object out of the
    response. Headers is only sent. Used for
    debugging.
  • HTTP/1.1
  • GET, POST, HEAD
  • PUT
  • uploads file in entity body to path specified in
    URL field
  • DELETE
  • deletes file specified in the URL field

15
Cookies keeping state
  • Many major Web sites use cookies
  • Four components
  • 1) cookie header line in the HTTP response
    message
  • 2) cookie header line in HTTP request message
  • 3) cookie file kept on users host and managed by
    users browser
  • 4) back-end database at Web site
  • Example
  • Susan access Internet always from same PC
  • She visits a specific e-commerce site for first
    time
  • When initial HTTP requests arrives at site, site
    creates a unique ID and creates an entry in
    backend database for ID

16
Cookies keeping state (cont.)
Amazon server creates ID 1678 for user
entry in backend database
access
access
one week later
17
Cookies (continued)
aside
  • Cookies and privacy
  • cookies permit sites to learn a lot about you
  • you may supply name and e-mail to sites
  • search engines use redirection cookies to
    learn yet more
  • advertising companies obtain info across sites
  • What cookies can bring
  • authorization
  • shopping carts
  • recommendations
  • user session state (Web e-mail)

18
Web caches (proxy server)
Goal satisfy client request without involving
origin server
origin server
  • user sets browser Web accesses via cache
  • browser sends all HTTP requests to cache
  • object in cache cache returns object
  • else cache requests object from origin server,
    then returns object to client

Proxy server
HTTP request
HTTP request
client
HTTP response
HTTP response
HTTP request
HTTP response
client
  • Web proxies can be multipurpose
  • cache,
  • Firewall
  • Monitor and log activites
  • NAT

origin server
19
More about Web caching
  • Local cache can be used to hold copies of visited
    pages
  • Cache acts as both client and server
  • Cache can do up-to-date check using
    If-modified-since HTTP header
  • HTTP response messages has Age header.
  • Specifies how long the info is valid for.
  • Typically cache is installed by ISP (university,
    company, residential ISP)
  • Why Web caching?
  • Reduce response time for client request.
  • Downloading HTML documents from servers may be
    slow
  • Internet congested
  • Dialup connection
  • Server busy
  • Reduce traffic on an institutions access link.

20
Conditional GET client-side caching
server
  • Goal dont send object if client has up-to-date
    cached version
  • client specify date of cached copy in HTTP
    request
  • If-modified-since ltdategt
  • server response contains no object if cached
    copy is up-to-date
  • HTTP/1.0 304 Not Modified

client
HTTP request msg If-modified-since ltdategt
object not modified
HTTP request msg If-modified-since ltdategt
object modified
This is basically what happens when you hit
Refresh or update button on the browser,
I.e. GET with If-modified-since of current date.
HTTP response HTTP/1.0 200 OK ltdatagt
Write a Comment
User Comments (0)
About PowerShow.com