Web Essentials
Web Essentials
Communication
World Wide Web
Date: 02-10-2024 6
HTTP
Connect { $ telnet www.example.org 80
Trying 192.0.34.166...
Connected to www.example.com
(192.0.34.166).
Escape character is ’^]’.
{
Send GET / HTTP/1.1
Request Host: www.example.org
{
Receive HTTP/1.1 200 OK
Response Date: Thu, 09 Oct 2003 20:30:49 GMT
…
Date: 02-10-2024 7
HTTP Request
Date: 02-10-2024 8
HTTP Request
Date: 02-10-2024 9
HTTP Request
Start line
Example: GET / HTTP/1.1
Three space-separated parts:
HTTP request method
Request-URI (Uniform Resource Identifier)
HTTP version
Date: 02-10-2024 10
HTTP Request
Start line
Example: GET / HTTP/1.1
Three space-separated parts:
HTTP request method
Request-URI
HTTP version
We will cover 1.1, in which version part of start line
must be exactly as shown
Date: 02-10-2024 11
HTTP Request
Start line
Example: GET / HTTP/1.1
Three space-separated parts:
HTTP request method
Request-URI
HTTP version
Date: 02-10-2024 12
HTTP Request
Start line
Example: GET / HTTP/1.1
Three space-separated parts:
HTTP request method
Request-URI
HTTP version
Date: 02-10-2024 15
HTTP Request
POST
Used when submit button is clicked on a form
Form information contained in body of request
HEAD
Requests that only header fields (no body) be returned
in the response
Date: 02-10-2024 16
HTTP Response
Date: 02-10-2024 17
HTTP Response
Date: 02-10-2024 18
HTTP Response
Status line
Example: HTTP/1.1 200 OK
Three space-separated parts:
HTTP version
status code
reason phrase (intended for human use)
Date: 02-10-2024 19
HTTP Response
Status code
Three-digit number
First digit is class of the status code:
1=Informational
2=Success
4=Client Error
5=Server Error
Date: 02-10-2024 21
HTTP Response
Date: 02-10-2024 23
Client Client Caching Server
Browser Web
Server
3. Store image
Cache
Date: 02-10-2024 24
Client Client Caching Server
Browser Web
Server
I need that
image
again…
Cache
Date: 02-10-2024 25
Client Client Caching Server
This…
Cache
Date: 02-10-2024 26
Client Client Caching Server
Browser Web
Server
I need that
image
again…
Get … or this
image
Cache
Date: 02-10-2024 27
Client Caching
Cache advantages
(Much) faster than HTTP request/response
Less network traffic
Less load on server
Cache disadvantage
Cached copy of resource may be invalid
(inconsistent with remote version)
Date: 02-10-2024 28
Client Caching
Date: 02-10-2024 29
Web Clients
Date: 02-10-2024 30
Web Browsers
First graphical browser running on general-
purpose platforms: Mosaic (1993)
Date: 02-10-2024 31
Web Browsers
Date: 02-10-2024 32
Web Browsers
Primary tasks:
Convert web addresses (URL’s) to HTTP
requests
Communicate with web servers via HTTP
Render (appropriately display) documents
returned by a server
Date: 02-10-2024 33
HTTP URL’s
http://www.example.org:56789/a/b/c.txt?t=win&s=chess#para5
authority Request-URI
Standard features
Save web page to disk
Find string in page
Fill forms automatically (passwords, CC numbers, …)
Set preferences (language, character set, cache and
HTTP parameters)
Modify display style (e.g., increase font sizes)
Display raw HTML and HTTP header info (e.g., Last-
Modified)
Choose browser themes (skins)
View history of web addresses visited
Bookmark favorite pages for easy return
Date: 02-10-2024 35
Web Browsers
Additional functionality:
Execution of scripts (e.g., drop-down menus)
Event handling (e.g., mouse clicks)
GUI for controls (e.g., buttons)
Secure communication with servers
Display of non-HTML documents (e.g., PDF)
via plug-ins
Date: 02-10-2024 36
Web Servers
Basic functionality:
Receive HTTP request via TCP
Map Host header to specific virtual host (one of many
host names sharing an IP address)
Map Request-URI to specific resource associated with
the virtual host
File: Return file in HTTP response
Program: Run program and return output in HTTP response
Date: 02-10-2024 39
Tomcat Web Server
Real
Browser www.example.org
Date: 02-10-2024 41
Secure Servers
Preventing Man-in-the-Middle
Fake Fake
DNS www.example.org
Server 100.1.1.1
What’s IP
address for 100.1.1.1 Send me a certificate of identity
www.example.org?
Real
Browser www.example.org
Date: 02-10-2024 43
Internet Protocol (IP)
Source
Network 1
Gateway
Destination
Gateway
Network 2 Network 3
Source
LAN 1
Gateway
Destination
Gateway
Limitations of IP:
No guarantee of packet delivery (packets can be
dropped)
Communication is one-way (source to destination)
TCP adds concept of a connection on top of IP
Provides guarantee that packets delivered
Provide two-way (full duplex) communication
OK.
{
Here’s a packet.
Send packet
Source Destination
with Got it.
acknowledgment.
Here’s a packet.
{
Resend packet if
no (or delayed) Here’s a resent packet.
acknowledgment.
Got it.