ccm 4223 lecture 10 computer networks: wireless and mobile communication systems dr e. ever
DESCRIPTION
CCM 4223 Lecture 10 Computer Networks: Wireless and Mobile Communication Systems Dr E. Ever School of Computing Science. -. -. K (R). K (R). A. T. +. +. K. K. A. T. -. -. +. +. m = K (K (m)). m = K (K (m)). +. +. A. T. A. T. K (m). K (m). A. T. - PowerPoint PPT PresentationTRANSCRIPT
1
CCM 4223 Lecture 10Computer Networks: Wireless and Mobile Communication Systems
Dr E. Ever
School of Computing Science
ccm4300 2
RECAP: security holeMan (woman) in the middle attack: Trudy
poses as Alice (to Bob) and as Bob (to Alice)
I am Alice I am Alice
R
TK (R)
-
Send me your public key
TK
+A
K (R)-
Send me your public key
AK
+
TK (m)+
Tm = K (K (m))+
T-
Trudy gets
sends m to Alice encrypted
with Alice’s public key
AK (m)+
Am = K (K (m))+
A-
R
ccm4300 3
RECAP: Digital signature = signed message digest
large
message
m
H: Hash
functionH(m)
digital
signature
(encrypt)
Bob’s
private
key K B
-
+
Bob sends digitally signed message:
Alice verifies signature and integrity of digitally signed message:
KB(H(m))-
encrypted
msg digest
KB(H(m))-
encrypted
msg digest
large
message
mH: Hash
function
H(m)
digital
signature
(decrypt)
H(m)
Bob’s
public
key K B
+
equal
?
4
Session Content
||| Introduction to WWW as a digital library
||| HyperText Markup Language (HTML)
- overview
- format and representation
||| HyperText Transfer Protocol (HTTP)
- overview
- message format
- http example
||| Summary
5
Lesson objectives
At the completion of this lesson you should be able to
- understand and describe characteristics of the HTML
- understand and describe the concepts of the HTTP
6
Introduction||| A conventional library is a more or less coherent and comprehensive collection of information: it so happens that the information is stored on paper.
||| The World Wide Web (WWW) can also be seen as a library: the fact that the information is stored electronically in a digital format leads us to refer to it as a digital library.
||| The web was first conceived in 1989 by Tim Berners-Lee (U.K.) at CERN. using traditional database was difficult to store informationthe first web client and server in 1990His specifications of URLs, HTTP and HTML were refined as Web technology spread. used hypertext network of information instead
- any document can contain a link to any other document Marc Andreessen (USA) led a team that wrote Mosaic, the first graphical web browser, by the end of 1993
- in 1994, Andreessen and some colleagues formed Netscape Communication Corporation, which is now owned by AOL.
MOSAIC WEB BROWSER (1993)
8
Introduction - cont||| With a digital library, as with a conventional one, information must be stored and must then be made accessible.
||| On the Web, the information is stored in documents on Internet computers, which act as Web servers, and is made available from them on request by clients (i.e., uses a client-server model).
||| Documents are stored in mark-up language using HyperText Markup Language (HTML).
||| A document is accessed by using a browser to send a request for it and, when it is received, to display it in accordance with the way it is marked up.
||| The interchange takes place using the communication protocol known as HyperText Transfer Protocol (HTTP).
9
Network applications: some jargon
Process: program running within a host.
within same host, two processes communicate using interprocess communication (defined by OS).
processes running in different hosts communicate with an application-layer protocol
user agent: interfaces with user “above” and network “below”.
implements user interface & application-level protocol
Web: browser E-mail: mail reader streaming
audio/video: media player
10
Applications and application-layer protocolsApplication: communicating,
distributed processes e.g., e-mail, Web, P2P file
sharing, instant messaging running in end systems
(hosts) exchange messages to
implement application
Application-layer protocols one “piece” of an app define messages
exchanged by apps and actions taken
use communication services provided by lower layer protocols (TCP, UDP)
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
applicationtransportnetworkdata linkphysical
11
App-layer protocol defines Types of messages
exchanged, eg, request & response messages
Syntax of message types: what fields in messages & how fields are delineated
Semantics of the fields, ie, meaning of information in fields
Rules for when and how processes send & respond to messages
Public-domain protocols: defined in RFCs allows for
interoperability eg, HTTP, SMTP
Proprietary protocols: eg, KaZaA
12
Client-server paradigmTypical network app has two
pieces: client and serverapplicatio
ntransportnetworkdata linkphysical
application
transportnetworkdata linkphysical
Client:initiates contact with server (“speaks first”)
typically requests service from server,
Web: client implemented in browser; e-mail: in mail reader
request
reply
Server:provides requested service to client
e.g., Web server sends requested Web page, mail server delivers e-mail
13
Processes communicating across network
process sends/receives messages to/from its socket
socket analogous to door sending process shoves
message out door sending process asssumes
transport infrastructure on other side of door which brings message to socket at receiving process
process
TCP withbuffers,variables
socket
host orserver
process
TCP withbuffers,variables
socket
host orserver
Internet
controlledby OS
controlled byapp developer
API: (1) choice of transport protocol; (2) ability to fix a few parameters (lots more on this later)
API: Application Programming Interface
14
Processes communicating across network (2)
15
History of the Web World Wide Web, “Web”, “WWW” Tim Berners-Lee (3COM Founders , Director of the
World Wide Web Consortium (W3C), )at CERN in 1991 Demonstrated prototype at a conf. in ’91 Text-based
Marc Andreessen developed the first graphical Web browser in 1993: Mosaic
Andreessen founds Netscape Communications Browser war starts around 1995-96 America Online buys Netscape in 1998
16
Some “Web” Terminology Web page may contain links to other pages
(sometimes also called Web Objects) Object can be HTML file, JPEG image, Java
applet, audio file,… Web pages are “Hypertexts”
One page points to another Proposed by Prof. Vannevar Bush in
1945! Each object is addressable by a URL:http://www.someschool.edu/someDept/pic.gif
path namehost nameprotocol
17
Types of web pages
Static page/document: contents do not change unless the author changes it
Static Dynamic page/document: does not exist in a predefined form, it is created
whenever a browser requests it Page content and page layout are created separately. The
content is retrieved from a database and is placed on a webpage only when needed or asked.
http://www.cineworld.co.uk/
Active page/document: it is not fully specified, it consists of a programme that understands how to compute and display the value, the program can run on the client machine (http://www.calculator.net/scientific-calculator.html)
18
Hypertext Mark-up Language (HTML) 0
||| Each Web pages are written in a language called HTML.
||| HTML allows users to produce a Web page that includes text, graphics, and pointers to other Web pages known as hyperlinks.
||| Technically, the web is a distributed hypermedia (i.e. hypertext mixed with other media e.g. audio tracks, video clips, or both) system that supports interactive access
Why is HTML called a mark-up language??Because it does not contain a detailed formatting instruction.
Instead of specifying a detailed document format, HTML allows a document to contain a general guidelines for display, and allows a browser to choose details. Consequently, two browsers may display an HTML document differently.
19
||| Each HTML document is divided into two major parts: A head – contains details about the document A body – contains the majority of the information
||| Syntactically, each HTML document is represented as a text file that contains tags along with other information.
||| HTML tags provide structure for the document as well as formatting hints for the web browser.
||| To specify an immediate action or to start a formatting operation a tag name is bracketed by less-than and greater-than symbol.
<TAGNAME>||| To end operation - corresponding tag with two character sequence
less than and slash, and ends with a greater-than symbol.
</TAGNAME>
0
HTML format and representation
20
0
HTML format and representation<html>...</html>
The Root element of an HTML document; all other elements are contained in this. The HTML element delimits the beginning and the end of an HTML document. Standardised in HTML 2.0; still current.
<head>...</head>Container for processing information and metadata for an HTML document. Standardised in HTML 2.0; still current.
<body>...</body>Container for the displayable content of an HTML document. Standardised in HTML 2.0; still current.
21
||| The following simple example illustrates the form of an HTML document:<head><TITLE> Simple Example</TITLE></head><body><H1>Heading</H1><P>A short illustrative paragraph that includes a single hyperlink to the <A HREF=“http://www.w3.org/”>WWW Consortium home page</A>.</P></body></html>
||| The HTML code above will be interpreted and displayed by a browser in a form similar to that shown below:
HeadingA short illustrative paragraph that includes a single hyperlink to the WWW Consortium home page.
HTML format and representation - cont
HEADBODY
HTML EXAMPLE
<html>
<head>
<title>Hello</title>
</head>
<body>
<p>Hello, world!</p>
<p>This is a picture: <img src="some-image.gif"></p>
<p>This is a <a href="another-page.html">link</a> to another page.</p>
</body>
</html>
23
||| When a Web browser interacts with a Web server, the two programs follow the HTTP.
||| HTTP is an layer protocol
The HTTP protocol ….
||| HTTP - client/server model
client: browser that requests, receives, “displays” Web objects
server: Web server sends objects in response to requests
||| Before 1998 - http1.0: RFC 1945
||| http1.1: RFC 2068
PC runningExplorer
Server running
apache Webserver
Mac runningNavigator
http request
http re
quest
http response
http re
sponse
application
24
||| The generic client-server interaction proceeds through four stages:
1. Send request.
e.g. ‘http://www.mdx.ac.uk/cs/lecture6.html’
2. Receive request.
The named computer (a Web server) receives the request and locates the file in its file store.
3. Send response.
The Web server sends the requested file to the requesting computer.
4. Receive response.
The client machine receives the file and its browser displays it in accordance with the way it is marked up.
The HTTP protocol - cont
25
The HTTP protocol - cont
http: TCP transport service:
||| client initiates TCP connection (creates socket) to server, port 80
||| server accepts TCP connection from client
||| http messages (application-layer protocol messages) exchanged between browser (http client) and Web server (http server)
||| TCP connection closed
http is “stateless”
||| server maintains no information about past client requests
Protocols that maintain “state” are complex!
||| past history (state) must be maintained
||| if server/client crashes, their views of “state” may be inconsistent, must be reconciled
aside
26
Concepts
||| A web page (also referred to as document) consists of objects.
||| An object is simply a file such as an HTML file, JPEG file, a Java applet, an audio clip, etc.
||| Most web pages consist of a base HTML file and several referenced objects
||| For example, if a Web page contains HTML text and five JPEG images, then the Web page has six objects.
The HTTP protocol - contHTTP : Uniform Resource Locator (URL)
||| Each object is addressable by a single URL
||| Each URL has two components: - the host name of the server that houses the object and - the object’s path name
||| For example:
www.mdx.ac.uk/cs/alasebae/pec.jpg
- www.mdx.ac.uk for a host name
- /someDepartment/logo.gif for a path name
27
application
transportNetworkNetwork access
1. SYN 1. SYN
2. SYN + ACK2. SYN + ACK3. ACK 3. ACKapplicatio
ntransportNetworkNetwork access
TCP three-way handshake
4. Data flow begins 4. Receive data
Three-wayThree-wayhandshakehandshake
CloseClose
timetime
SYNSYN
ACKACK
SYN +SYN +ACKACKOpenOpen
FINFIN
ACKACK
ACKACK
FINFIN
Initiates a connection
Accepts and acknowledges
Acknowledges and begins tx
28
HTTP example (1.0)Suppose user enters URL www.someSchool.edu/someDepartment/home.index
1a. http client initiates TCP connection to http server (process) at www.cs.mdx.ac.uk Port 80 is default for http server.
2. http client sends http request message (containing URL) into TCP connection socket
1b. http server at host www.cs.mdx.ac.uk waiting for TCP connection at port 80 (HTTP uses port 80 ). “accepts” connection, notifying client
3. http server receives request message, forms response message containing requested object (someDepartment/home.index), sends message into sockettime
(e.g. contains text, references to 5
jpeg images)
29
HTTP example - cont
5. http client receives response message containing html file, displays html. Parsing html file, finds 5 referenced jpeg objects
6. Steps 1-5 repeated for each of 5 jpeg objects
4. http server closes TCP connection.
time
30
||| Steps above above uses non-persistent connection because each TCP connection is closed after the server sends the object
the connection does not persist for other objects
||| Thus, in this example, when a user request the Web page, 6 TCP connections are generated:
for each connection, TCP buffers must be allocated
- serious burden on web server each object suffers two round-trip time (RTT)
- one RTT to establish the TCP connection and one RTT to request and receive an object
each object suffers from TCP slow start due to congestion control mechanism employed by TCP
- slow start initially before ramp up to relative high rate
HTTP example shortcomings
31
Slow Start
32
Non-persistent, persistent connectionsNon-persistent||| http/1.0: server parses
request, responds, closes TCP connection
||| 2 round-trip times (RTTs) to fetch object
TCP connection object request/transfer
||| each transfer suffers from TCP’s initially slow sending rate
||| many browsers open multiple parallel connections
Persistent
||| default for http/1.1 Pipelined Non-pipelined
||| on same TCP connection: server, parses request, responds, parses new request,..
||| client sends requests for all referenced objects as soon as it receives base HTML.
||| fewer RTTs, less slow start.
33
Persistent HTTP
Nonpersistent HTTP issues: requires 2 RTTs per object OS overhead for each TCP
connection browsers often open parallel
TCP connections to fetch referenced objects
Persistent HTTP server leaves connection
open after sending response subsequent HTTP messages
between same client/server sent over open connection
Persistent without pipelining: client issues new request
only when previous response has been received
one RTT for each referenced object
Persistent with pipelining: default in HTTP/1.1 client sends requests as
soon as it encounters a referenced object
as little as one RTT for all the referenced objects
34
Performance Comparison
HTML page (of size 5Kbp)
10 images (each of size 5Kb)
RTT 100 m seconds
5 parallel connections
David J. Yates
HT
TP
Res
pons
e tim
e( s
econ
ds)
35
||| two types of http messages: request, response
||| http request message: ASCII (human-readable format) Get to request object, Post when user fills in form,
Head respond without object for debug purpose 1st line request(GET, POST,
HEAD commands)
Subsequent linesCalled header lines
Carriage return, line feed
indicates end of message
GET /somedir/page.html HTTP/1.0 Host www.someschool.eduConnection: closeUser-agent: Mozilla/4.0Accept-language:fr
(extra carriage return, line feed)
HTTP message format: request
Indicates non-persistent connection
36
Response time modelingDefinition of RTT: time to send
a small packet to travel from client to server and back.
Response time: one RTT to initiate TCP
connection one RTT for HTTP request
and first few bytes of HTTP response to return
file transmission time
total = 2RTT+transmit time
time to transmit file
initiate TCPconnection
RTT
requestfile
RTT
filereceived
time time
37
HTTP message format: request - cont
38
Uploading form input
Post method: Web page often
includes form input Input is uploaded to
server in entity body
URL method: Uses GET method Input is uploaded in
URL field of request line:
www.yoursite.com/yoursearch?cw&exams
Submits data to be processed (e.g., from an HTML form) to the identified resource. The data is included in the body of the request.
Requests a representation of the specified resource
39
Method types
HTTP/1.0 GET POST HEAD
asks server to leave requested object out of response
HTTP/1.1 GET, POST, HEAD PUT
uploads file in entity body to path specified in URL field
DELETE deletes file specified
in the URL field
40
Classical HTTP/1.0http://www.somewhere.com/index.html
index.html references: page1.jpg,page2.jpg, page3.jpg.
time to transmit index.hml
initiate TCPconnection
RTT
GET index.html
RTT
filereceived
GET page1.jpg
time to transmit page1.jpg
GET: Retrieves a read-only copy of a file
POST: sending forms that interactively completed by user browser
HEAD: it returns information about data
41
HTTP/1.0 200 OK Connection: closeDate: Thu, 06 Aug 2006 12:00:15 GMT Server: Apache/1.3.0 (Unix) Last-Modified: Mon, 22 Jun 2006 …... Content-Length: 6821 Content-Type: text/html data data data data data ...
status line(protocol
status codestatus phrase)
header lines
data, e.g., requestedhtml file
HTTP message format: response
42
HTTP response status codes
200 OK request succeeded, requested object later in this
message301 Moved Permanently
requested object moved, new location specified later in this message (Location:)
400 Bad Request request message not understood by server
404 Not Found requested document not found on this server
505 HTTP Version Not Supported
In first line in server->client response message.
A few sample codes:
43
User-server interaction: authentication
Authentication: control access to server content
||| authorisation credentials: typically name, password
||| stateless: client must present authorisation in each request
- authorisation: header line in each request
- if no authorisation: header, server refuses access, sends
WWW authenticate: header line in response
client server
usual http request msg
401: authorisation req.WWW authenticate:
usual http request msg+ Authorisation: <cred>
usual http response msg
usual http request msg+ Authorisation: <cred>
usual http response msg time
Despite HTTP server is “stateless” – HTTP provides two mechanism:
44
Cookies: keeping “state”
||| server-generated # , server-remembered #, later used for:- authentication- remembering user
preferences, previous choices
||| server sends “cookie” to client in response msgSet-cookie: 1678453
||| client presents cookie in later requestscookie: 1678453
client server
usual http request msg
usual http response +Set-cookie: #
usual http request msgcookie: #
usual http response msg
usual http request msgcookie: #
usual http response msg
cookie-specificaction
cookie-specificaction
45
Cookies: keeping “state” (cont.)
client server
usual http request msgusual http response
+Set-cookie: 1678
usual http request msg
cookie: 1678usual http response
msg
usual http request msg
cookie: 1678usual http response msg
cookie-specificaction
cookie-specificaction
servercreates ID
1678 for user
entry in backend
database
access
acce
ss
Cookie file
amazon: 1678ebay: 8734
Cookie file
ebay: 8734
Cookie file
amazon: 1678ebay: 8734
one week later:
46
Cookies (continued)What cookies can bring:
authorisation
shopping carts
recommendations
user session state (Web e-mail)
Cookies and privacy: cookies permit sites to
learn a lot about you you may supply name
and e-mail to sites search engines use
redirection & cookies to learn yet more
advertising companies obtain info across sites
aside
47
Conditional GET: client-side caching
||| Goal: don’t send object if client has up-to-date cached version
||| client: specify date of cached copy in http request
If-modified-since: <date>
||| server: response contains no object if cached copy is up-to-date:
HTTP/1.0 304 Not Modified
client server
http request msgIf-modified-since:
<date>
http responseHTTP/1.0
304 Not Modified
object not
modified
http request msgIf-modified-since:
<date>
http responseHTTP/1.1 200 OK
<data>
object modified
48
Web Caches (proxy server)
||| user sets browser: Web accesses via web cache
||| client sends all http requests to web cache
- object in web cache: web cache returns object
- else web cache requests object from origin server, then returns object to client
Goal: satisfy client request without involving origin server
client
Proxyserver
client
http request
http re
quest
http response
http re
sponse
http request
http response
origin server
origin server
49
Web Caching Hierarchy
client
local proxy cache(e.g., local ISP,
University)
regional proxy cache
national/international proxy cache
50
Why Web Caching?
Assume: cache is “close” to client (e.g., in same network)
||| smaller response time: cache “closer” to client
||| decrease traffic to distant servers
- link out of institutional/local ISP network often bottleneck
originservers
public Internet
institutionalnetwork 10 Mbps LAN
1.5 Mbps access link
institutionalcache
51
Issues of Web Caching...||| Read/Write Operation
- read operation vs. write operation
||| Consistency :accessing from cache vs. accessing from server
-Strong consistency
-Weak consistency
||| Main memory buffer
- Cache size vs. performance
||| All objects cannot be cached
-e.g, dynamic objects
52
Weak Consistency Each cached copy has a TTL beyond which it
must be validated with the origin server TTL = freshness life time – age
freshness life time: often heuristically calculated; sometimes based on MAX_AGE or EXPIRES headers
age = current time (at client) – timestamp on object (time at which server generated response)
Age Penalty?
53
Content Distribution Networks (CDNs)
The content providers are the CDN customers.
Content replication
CDN company installs hundreds of CDN servers throughout Internet in lower-tier ISPs,
close to usersCDN replicates its customers’
content in CDN servers. When provider updates content, CDN updates servers
origin server in North America
CDN distribution node
CDN serverin S. America CDN server
in Europe
CDN serverin Asia
54
HTTP Performance Modelling (roughly)
Assume Web page consists of:
1 base HTML page (of size X bits)
M images (each of size X bits)
Non-persistent HTTP:
M+1 TCP connections in series
Response time = (M+1)Y/R + (M+1)2RTT + sum of idle times
55
HTTP Performance Modelling (2)
Persistent connections:
2 RTT to request and receive base HTML file
1 RTT to request and receive M images
Response time = (M+1)X/R + 3RTT + sum of idle times
Non-persistent HTTP with Y parallel connections
Suppose M/Y integer.
1 TCP connection for base file
M/Y sets of parallel connections for images.
Response time = (M+1)X/R + (M/Y + 1)2RTT + sum of idle times
56
Summary!||| The WWW is a distributed hypermedia repository of information (i.e. digital library) that is accessed with an interactive browser
||| A browser displays a Web page of information.
||| Web pages are written in the HTML
||| Web browser interacts with a Web server via the HTTP