Lecture No 2 Fall 2020
Lecture No 2 Fall 2020
2-1
HTTP (HyperTextTransferProtocol)
❖ It’s a protocol used for transferring HyperText
❖ What is HyperText
2-2
HTTP (HyperTextTransferProtocol)
2-4
URLs – Uniform Resource Locaters
Some common URLs.
2-5
What is HTML HyperTextMarkupLanguage
2-6
Sample HTML Code and its Output
2-7
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
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
connection RTT
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
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