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
{
HTTP/1.1 200 OK
Receive
Date: Thu, 09 Oct 2003 20:30:49 GMT
Response
…
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 Request
Date: 02-10-2024 17
HTTP Request
Date: 02-10-2024 19
HTTP Quality Values and
Wildcards
Example header field with quality values:
accept:
text/xml,text/html;q=0.9,
text/plain;q=0.8, image/jpeg,
image/gif;q=0.2,*/*;q=0.1
Quality value applies to all preceding items
Higher the value, higher the preference
Note use of wildcards to specify quality 0.1
Date: 02-10-2024 20
HTTP Request
Date: 02-10-2024 22
HTTP Response
Date: 02-10-2024 23
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 24
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 26
HTTP Response
Date: 02-10-2024 28
Client Client Caching Server
Browser Web
Server
3. Store image
Cache
Date: 02-10-2024 29
Client Client Caching Server
Browser Web
Server
I need that
image
again…
Cache
Date: 02-10-2024 30
Client Client Caching Server
This…
Cache
Date: 02-10-2024 31
Client Client Caching Server
Browser Web
Server
I need that
image
again…
Get … or this
image
Cache
Date: 02-10-2024 32
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 33
Client Caching
Date: 02-10-2024 34
Character Sets
Date: 02-10-2024 38
Web Browsers
First graphical browser running on general-
purpose platforms: Mosaic (1993)
Date: 02-10-2024 39
Web Browsers
Date: 02-10-2024 40
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 41
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 43
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 44
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 47
Web Servers
Date: 02-10-2024 48
Tomcat Web Server
Date: 02-10-2024 49
Tomcat Web Server
Date: 02-10-2024 50
Tomcat Web Server
Date: 02-10-2024 51
Tomcat Web Server
Date: 02-10-2024 52
Tomcat Web Server
Date: 02-10-2024 53
Tomcat Web Server
Date: 02-10-2024 54
Tomcat Web Server
Date: 02-10-2024 55
Tomcat Web Server
Date: 02-10-2024 56
Tomcat Web Server
Date: 02-10-2024 59
Tomcat Web Server
Access control:
Password protection (e.g., admin pages)
Users
and roles defined in
conf/tomcat-users.xml
Deny access to machines
Useful for denying access to certain users by denying
access from the machines they use
List of denied machines maintained in
Date: 02-10-2024 62
Secure Servers
Man-in-the-Middle Attack
Fake Fake
DNS www.example.org
Server 100.1.1.1
What’s IP
address for 100.1.1.1 My credit card number is…
www.example.org?
Real
Browser www.example.org
Date: 02-10-2024 63
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 64