L02 WT 01 WebEssentials
L02 WT 01 WebEssentials
2
The Internet
Open-access networks
Regional university networks (e.g., SURAnet)
CSNET for CS departments not on ARPANET
NSFNET (1985-1995)
Full form: National Science Foundation Network
Primary purpose: connect supercomputer centers
Secondary purpose: provide backbone to connect
regional networks
3
The Internet
4
The Internet
5
The Internet
6
Internet Protocols
7
Internet Protocol (IP)
8
IP
9
IP
Source
Network 1
Gateway Destination
Gateway
Network 2 Network 3
10
IP
Source
LAN 1
Gateway Destination
Gateway
11
Transmission Control Protocol
(TCP)
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
12
TCP
Establish
connection.
{ Can I talk to you?
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.
13
TCP
14
TCP
15
User Datagram Protocol (UDP)
16
Domain Name Service (DNS)
DNS is the “phone book” for the Internet
Map between host names and IP addresses
DNS often uses UDP for communication
Host names
Labels separated by dots, e.g., www.example.org
Final label is top-level domain
Generic: .com, .org, etc.
Country-code: .us, .il, etc.
17
DNS
Domains are divided into second-level domains,
which can be further divided into subdomains, etc.
E.g., in www.example.com, example is a
second-level domain
A host name plus domain name information is
called the fully qualified domain name of the
computer
Above, www is the host name, www.example.com
is the FQDN
18
DNS
addresses.
Address returned is the canonical IP address
19
DNS
20
Higher-level Protocols
Many protocols build on TCP
Telephone analogy: TCP specifies how we initiate
and terminate the phone call, but some other protocol
specifies how we carry on the actual conversation
Some examples:
SMTP (email) (25)
FTP (file transfer) (21)
HTTP (transfer of Web documents) (80)
22
World Wide Web
23
World Wide Web
24
Hypertext Transport Protocol
(HTTP)
25
HTTP
26
HTTP
27
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
…
28
HTTP Request
29
HTTP Request
30
HTTP Request
Start line
Example: GET / HTTP/1.1
Three space-separated parts:
HTTP request method
Request-URI (Uniform Resource Identifier)
HTTP version
31
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
32
HTTP Request
Start line
Example: GET / HTTP/1.1
Three space-separated parts:
HTTP request method
Request-URI
HTTP version
33
HTTP Request
34
URI
35
HTTP Request
Start line
Example: GET / HTTP/1.1
Three space-separated parts:
HTTP request method
Request-URI
HTTP version
36
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
37
HTTP Request
38
HTTP Request
39
Multipurpose Internet Mail
Extensions (MIME)
40
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 for
any MIME type not specified earlier
41
HTTP Request
42
HTTP Response
43
HTTP Response
44
HTTP Response
Status line
Example: HTTP/1.1 200 OK
Three space-separated parts:
HTTP version
status code
reason phrase (intended for human use)
45
HTTP Response
Status code
Three-digit number
First digit is class of the status code:
1=Informational
2=Success
3=Redirection (alternate URL is supplied)
4=Client Error
5=Server Error
Other two digits provide additional information
See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
46
HTTP Response
47
HTTP Response
48
Client Caching
49
Client Client Caching Server
Browser Web
Server
3. Store image
Cache
50
Client Client Caching Server
Browser Web
Server
I need that
image
again…
Cache
51
Client Client Caching Server
This…
Cache
52
Client Client Caching Server
Browser Web
Server
I need that
image
again…
Get … or this
image
Cache
53
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)
54
Client Caching
55
Character Sets
56
Character Sets
57
Character Sets
Typical US PC produces ASCII documents
US-ASCII character set can be used for such
documents, but is not recommended
UTF-8 and ISO-8859-1 are supersets of US-ASCII and
provide international compatibility
UTF-8 can represent all ASCII characters using a single byte
each and arbitrary Unicode characters using up to 4 bytes each
ISO-8859-1 is 1-byte code that has many characters common in
Western European languages, such as é
58
Web Clients
59
Web Browsers
First graphical browser running on general-
purpose platforms: Mosaic (1993)
60
Web Browsers
61
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
62
HTTP URL’s
http://www.example.org:56789/a/b/c.txt?t=win&s=chess#para5
authority Request-URI
63
Web Browsers
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
64
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
65
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
Map type of resource to appropriate MIME type and use to
set Content-Type header in HTTP response
Log information about the request and response
66
Web Servers
67
Web Servers
68
Web Servers
69
Tomcat Web Server
70
Tomcat Web Server
71
Tomcat Web Server
72
Tomcat Web Server
73
Tomcat Web Server
74
Tomcat Web Server
75
Tomcat Web Server
76
Tomcat Web Server
77
Tomcat Web Server
78
Tomcat Web Server
79
Tomcat Web Server
80
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 RemoteHostValve (deny
81
Secure Servers
82
Secure Servers
I’d like to talk securely to you (over port 443)
83
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
84
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
85