0% found this document useful (0 votes)
37 views33 pages

Lecture No 2 Fall 2020

Uploaded by

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

Lecture No 2 Fall 2020

Uploaded by

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

Application layer protocols

2-1
HTTP (HyperTextTransferProtocol)
❖ It’s a protocol used for transferring HyperText
❖ What is HyperText

2-2
HTTP (HyperTextTransferProtocol)

❖ In reality It is a protocol that is used to transfer


webpages
❖ Web page consists of base HTML-file which
includes several referenced objects
❖ These object can be HTML files, JPEG images, Java
applet, audio file,s…
❖ each object is addressable by a URL, e.g.,
❖ A typical URL is shown below:
www.someschool.edu/someDept/pic.gif

host name path name


2-3
A Typical URL

2-4
URLs – Uniform Resource Locaters
Some common URLs.

2-5
What is HTML HyperTextMarkupLanguage

❖ HTML documents are simply text documents


with a specific form
▪ Documents comprised of content and markup tags
▪ Content: actual information being conveyed
▪ The markup tags tell the Web browser how to
display the page
▪ An HTML file must have an htm or html file
extension
▪ An HTML file can be created using a simple text
editor

2-6
Sample HTML Code and its Output

2-7
Boldface Tags

Effect of Boldface Tags

2-8
Steps in HTTP Connection
1) URL is typed in the address bar.
2) Browser checks with DNS server to convert it to an IP
address
3) Connects to the server requested
4) Using HTTP or HTTPS protocol requirements, the
browser sends a GET request to the server to ask for
the desired html document (usually index.html)
5) The server sends the HTML code for the web page to
the browser.
6) The browser interprets the HTML code and formats the
page to fit the browser window.
7) See the next slide for an example.

2-9
2-10
2-11
Message Categories

2-12
HTTP Transaction

2-13
Request and Response Messages

2-14
Figure : Formats of the request and response messages

2-15
HTTP request message

❖ two types of HTTP messages: request, response


❖ HTTP request message:
▪ ASCII (human-readable format)
carriage return character
line-feed character
request line
(GET, POST, GET /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\r\n
User-Agent: Firefox/3.6.10\r\n
Accept: text/html,application/xhtml+xml\r\n
header Accept-Language: en-us,en;q=0.5\r\n
lines Accept-Encoding: gzip,deflate\r\n
Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n
carriage return, Keep-Alive: 115\r\n
Connection: keep-alive\r\n
line feed at start
\r\n
of line indicates
end of header lines
2-16
HTTP - methods

2-17
Method types
HTTP/1.0: HTTP/1.1:
❖ GET ❖ GET, POST, HEAD
❖ POST ❖ PUT
❖ HEAD ▪ uploads file in entity
▪ asks server to leave body to path specified
requested object out in URL field
of response ❖ DELETE
▪ deletes file specified in
the URL field

2-18
HTTP response message
status line
(protocol
status code HTTP/1.1 200 OK\r\n
status phrase) Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n
Server: Apache/2.0.52 (CentOS)\r\n
Last-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\n
header ETag: "17dc6-a5c-bf716880"\r\n
Accept-Ranges: bytes\r\n
lines Content-Length: 2652\r\n
Keep-Alive: timeout=10, max=100\r\n
Connection: Keep-Alive\r\n
Content-Type: text/html; charset=ISO-8859-
1\r\n
\r\n
data, e.g., data data data data data ...
requested
HTML file
2-19
HTTP - responses

2-20
HTTP - Some Message Headers

2-21
HTTP connections
non-persistent HTTP persistent HTTP
❖ at most one object ❖ multiple objects can
sent over TCP be sent over single
connection TCP connection
▪ connection then between client, server
closed
❖ downloading multiple
objects required
multiple connections

2-22
Non Persistent HTTP connections

2-23
Non Persistent HTTP connections
suppose user enters URL: (contains text,
www.someSchool.edu/someDepartment/home.index references to 10
jpeg images)
1a. HTTP client initiates TCP
connection to HTTP server
(process) at 1b. HTTP server at host
www.someSchool.edu on port www.someSchool.edu waiting
80 for TCP connection at port 80.
“accepts” connection, notifying
2. HTTP client sends HTTP request client
message (containing URL) into
TCP connection socket. 3. HTTP server receives request
Message indicates that client message, forms response
wants object message containing requested
someDepartment/home.index object, and sends message into
its socket
time
2-24
Non Persistent HTTP connections
4. HTTP server closes TCP
connection.
5. HTTP client receives response
message containing html file,
displays html. Parsing html file,
finds 10 referenced jpeg objects

time
6. Steps 1-5 repeated for each of
10 jpeg objects

2-25
Non-persistent HTTP: response time

RTT (definition): time for a


small packet to travel from
client to server and back
HTTP response time: initiate TCP
❖ one RTT to initiate TCP
connection

connection RTT

❖ one RTT for HTTP request


request
file
and first few bytes of HTTP RTT
time to
response to return transmit
file
❖ file transmission time file
received
❖ non-persistent HTTP
response time =
time time
2RTT+ file transmission
time

2-26
Persistent HTTP connections

2-27
26.27
Cookies: keeping “state”
client server

ebay 8734
usual http request msg Amazon server
cookie file creates ID
usual http response
1678 for user create backend
ebay 8734
set-cookie: 1678 entry database
amazon 1678
usual http request msg
cookie: 1678 cookie- access
specific
usual http response msg action

one week later:


access
ebay 8734 usual http request msg
amazon 1678 cookie: 1678 cookie-
specific
usual http response msg action
2-28
Cookies (continued)
aside
what cookies can be used cookies and privacy:
for: ❖ cookies permit sites to
❖ authorization learn a lot about you
❖ shopping carts
❖ you may supply name and
❖ recommendations
e-mail to sites
❖ user session state (Web
e-mail)

how to keep “state”:


❖ protocol endpoints: maintain state at
sender/receiver over multiple
transactions
❖ cookies: http messages carry state

2-29
2-30
Web caches (proxy server)
goal: responds to the client request without involving origin
server
❖ user sets browser: Web
accesses via cache proxy
❖ browser sends all HTTP server
requests to cache client
origin
▪ object in cache: cache server
returns object
▪ else cache requests
object from origin
server, then returns
object to client client origin
server

2-31
More about Web caching
❖ cache acts as both why Web caching?
client and server ❖ reduce response time
▪ server for original for client request
requesting client
▪ client to origin server ❖ reduce traffic on an
❖ typically cache is institution’s access link
installed by ISP ❖ Internet dense with
(university, company, caches: enables “poor”
residential ISP) content providers to
effectively deliver
content (so too does
P2P file sharing)

2-32
Conditional GET
client server
❖ Goal: don’t send object if
cache has up-to-date
cached version HTTP request msg
object
If-modified-since: <date>
▪ no object transmission not
delay modified
▪ lower link utilization HTTP response
before
HTTP/1.0
❖ cache: specify date of 304 Not Modified <date>
cached copy in HTTP
request
If-modified-since:
<date> HTTP request msg
❖ server: response contains If-modified-since: <date> object
modified
no object if cached copy after
HTTP response
is up-to-date: HTTP/1.0 200 OK <date>
HTTP/1.0 304 Not <data>
Modified
2-33

You might also like