Web and HTTP Overview: Key Concepts
Web and HTTP Overview: Key Concepts
Comp416/Elec416
Computer Networks
Notes 7
Web and HTTP (part 1)
Web and HTTP
First, a quick review…
web page consists of objects, each of which can be stored on
different Web servers
object can be HTML file, JPEG image, Java applet, audio file,…
web page consists of base HTML-file which includes several
referenced objects, each addressable by a URL (Uniform
Resource Locator),
Example URL:
[Link]/someDept/[Link]
time time
Non-persistent HTTP response time = 2RTT+ file transmission time
Non-persistent and Persistent HTTP
non-persistent HTTP issues:
Persistent without pipelining:
requires 2 RTTs per object
client issues a new request
OS overhead to allocate host only when previous
resources for each TCP connection response has been received
But browsers often open parallel one RTT for each referenced
TCP connections to fetch object
referenced objects
Persistent with pipelining:
persistent HTTP
default in HTTP/1.1
server leaves connection open
after sending response client sends requests as soon
as it encounters a referenced
subsequent HTTP messages object
between the same client/server
are sent over this connection as little as one RTT for all the
referenced objects
Non-persistent and Persistent HTTP
n objects in a base .html file
Non-persistent HTTP:
- no parallel connections
2 RTT + tr_b + (2 RTT + tr_o) * n
- parallel connections
2 RTT + tr_b + (2 RTT + tr_o)
Persistent HTTP:
- without pipelining
2 RTT + tr_b + (RTT + tr_o) * n
- with pipelining
2 RTT + tr_b + (RTT + n * tr_o)
HTTP request message
two types of HTTP messages: request, response
HTTP request message:
• ASCII (human-readable format)
carriage return character
line-feed character
request line (GET, POST,
GET /[Link] HTTP/1.1\r\n
HEAD commands) Host: [Link]\r\n
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X
10.15; rv:80.0) Gecko/20100101 Firefox/80.0 \r\n
header Accept: text/html,application/xhtml+xml\r\n
lines Accept-Language: en-us,en;q=0.5\r\n
Accept-Encoding: gzip,deflate\r\n
Connection: keep-alive\r\n
\r\n
carriage return, line feed
at start of line indicates
end of header lines * Check out the online interactive exercises for more
examples: [Link]
HTTP request message: general format
method sp URL sp version cr lf request
line
header field name value cr lf
header
~
~ ~
~ lines
~
~ entity body ~
~ body
Other HTTP request messages
POST method: HEAD method:
web page often includes form requests headers (only) that
input would be returned if specified
user input sent from client to URL were requested with an
server in entity body of HTTP HTTP GET method.
POST request message
PUT method:
uploads new file (object) to server
GET method (for sending data to server): completely replaces file that exists
include user data in URL field of HTTP at specified URL with content in
GET request message (following a ‘?’): entity body of POST HTTP request
[Link]/animalsearch?monkeys&banana
message
HTTP response message
status line (protocol HTTP/1.1 200 OK
status code status phrase) Date: Tue, 08 Sep 2020 [Link] GMT
Server: Apache/2.4.6 (CentOS)
OpenSSL/1.0.2k-fips PHP/7.4.9
mod_perl/2.0.11 Perl/v5.16.3
header Last-Modified: Tue, 01 Mar 2016 [Link] GMT
lines ETag: "a5b-52d015789ee9e"
Accept-Ranges: bytes
Content-Length: 2651
Content-Type: text/html; charset=UTF-8
\r\n
data, e.g., requested data data data data data ...
HTML file
* Check out the online interactive exercises for more examples: [Link]
HTTP response status codes
status code appears in 1st line in server-to-client response message.
some sample codes:
200 OK
• request succeeded, requested object later in this message
301 Moved Permanently
• requested object moved, new location specified later in this message (in
Location: field)
400 Bad Request
• request msg not understood by server
404 Not Found
• requested document not found on this server
505 HTTP Version Not Supported
Trying out HTTP (client side) for yourself
1. telnet to your favorite Web server:
telnet [Link] 80 opens TCP connection to port 80 (default HTTP server
port) at [Link]. edu.
anything typed in will be sent to port 80 at
[Link]
2. type in a GET HTTP request:
GET /kurose_ross/interactive/[Link] HTTP/1.1
Host: [Link]
by typing this in (hit carriage return twice), you send
this minimal (but complete) GET request to HTTP
server
Comp416/Elec416
Computer Networks
Notes 6
▪ Principles of network applications
Application layer: overview
Our goals: ▪ learn about protocols by
examining popular
▪ conceptual and application-layer protocols
implementation aspects of and infrastructure
application-layer protocols • HTTP
• transport-layer service • SMTP, IMAP
models • DNS
• client-server paradigm • video streaming systems, CDNs
• peer-to-peer paradigm ▪ programming network
applications
• socket API
Creating a network app
application
transport
write programs that: mobile network
network
data link
physical
▪ run on (different) end systems national or global ISP
▪ permanent IP address
▪ often in data centers, for scaling
clients: local or
regional ISP
▪ contact, communicate with server
▪ may be intermittently connected home network content
provider
▪ may have dynamic IP addresses network datacenter
network
communicate
▪ peers request service from other
peers, provide service in return to
other peers local or
regional ISP
• self scalability – new peers bring new
service capacity, as well as new service home network content
demands provider
network datacenter
application application
socket controlled by
process process app developer
transport transport
network network controlled
link by OS
link Internet
physical physical
Addressing processes
▪ to receive messages, process ▪ identifier includes both IP address
must have identifier and port numbers associated with
▪ host device has unique 32-bit process on host.
IP address ▪ example port numbers:
▪ Q: does IP address of host on • HTTP server: 80
which process runs suffice for • mail server: 25
identifying the process? ▪ IP Address + Port Number =
▪ A: no, many processes Transport Address
can be running on the ▪ to send HTTP message to
same host [Link] web server:
• IP address: [Link]
• port number: 80
An application-layer protocol defines:
▪ types of messages exchanged, open protocols:
• e.g., request, response ▪ defined in RFCs, everyone
▪ message syntax: has access to protocol
• what fields in messages & definition
how fields are delineated ▪ allows for interoperability
▪ message semantics ▪ e.g., HTTP, SMTP
• meaning of information in proprietary protocols:
fields
▪ e.g., Skype, Zoom
▪ rules for when and how
▪ Not available in the public
processes send & respond to
domain
messages
What transport service does an app need?
data integrity throughput
▪ some apps (e.g., file transfer, ▪ some apps (e.g., multimedia)
web transactions) require require minimum amount of
100% reliable data transfer throughput to be “effective”
▪ other apps (e.g., audio) can ▪ other apps (“elastic apps”)
tolerate some loss make use of whatever
throughput they get
timing
▪ some apps (e.g., Internet security
telephony, interactive games) ▪ encryption, data integrity,
require low delay to be “effective” …
Transport service requirements: common apps
application data loss throughput time sensitive?
1
Course Objective and Prerequisite
Principles of computer networks and protocols
Internet protocol stack application
Application Layer
Transport Layer transport
Network Layer: Control and Data Planes
network
Data Link Layer, Local Area Networks
Network and distributed applications link
Protocol design and analysis physical
Assessment of network performance
Software defined networking
Prerequisite:
Knowledge of Java programming
(Comp132 or equivalent)
Text Book and Course Material
Computer Networking:
A Top Down Approach
8th edition.
Jim Kurose, Keith Ross
Pearson Education, 2022.
These lecture viewgraphs are adapted from J.F Kurose and K.W.
Ross’s copyrighted material associated with their book.
4
Course elements & Grading
Assignments (In class written) 25%
Projects (Practical network programming and protocols projects) 35%
Midterm exam (Written) 30%
Participation (in questions/discussions and random attendance points) 10%
Your assignment average and project average should be at least 50 / 100 to
get a passing grade.
Academic Honesty
Please read KU Statement on Academic Honesty (on the course web site).
5
Practical contents
Network Socket Programming and TCP Protocol
6
Practical contents
Wireshark: Network Protocol Analyzer
7
Practical contents
8
Practical work: Course projects
Application layer:
supporting network applications application
transport
Transport layer:
process-process data transfer network
link
Network layer:
routing of datagrams from source physical
to destination
9
Outline
Computer Networks and the Internet
The Network Edge
The Network Core
Delay, Loss, and Throughput in Packet-Switched Networks
Protocol Layers and Their Service Models
Application Layer
Principles of Network Applications
The Web and HTTP, SMTP, DNS
Peer-to-Peer Applications, CDNs
Socket Programming (Creating Network Applications) with TCP and UDP
Transport Layer
Transport-Layer Services
Multiplexing and Demultiplexing
Connectionless Transport: UDP
Principles of Reliable Data Transfer and Protocols
Connection-Oriented Transport: TCP
Principles of Congestion Control, TCP Congestion Control
10
Outline (cnt’d)
Network Layer: Data Plane
Network layer overview: Forwarding and Routing
Service Models, Routers
The Internet Protocol (IP): Forwarding and Addressing in the Internet
Generalized Forwarding and Software Defined Networks (SDN)
11
Chapter 1: Introduction
Goal: Overview:
❑ get overview, ❑ what’s the Internet?
terminology and “feel”
❑ what’s a protocol?
of computer
networking ❑ network edge; hosts, access net,
❑ more depth, detail physical media
later in course ❑ network core: packet/circuit
❑ approach: switching, Internet structure
▪ use Internet as an ❑ performance: loss, delay,
example throughput
❑ protocol layers, service models
❑ history
12
The Internet: a “nuts and bolts” view
Billions of connected
computing devices: mobile network
Tweet-a-watt:
monitor energy use
bikes
Pacemaker & Monitor
messages local or
regional
• e.g., HTTP (Web), streaming video, ISP
Skype, TCP, IP, WiFi, 5G, Ethernet home network content
provider
HTTP network
Internet standards
datacenter
▪ network
Ethernet
• RFC: Request for Comments
• IETF: Internet Engineering Task Force enterprise
TCP
network
WiFi
The Internet: a “services” view
▪ Infrastructure that provides services
to applications: mobile network
• Web, streaming video, multimedia national or global ISP
teleconferencing, email, games, e-
commerce, social media, inter-connected
Streaming
appliances, … Skype video
service
Hi TCP connection
request
Hi TCP connection
response
Got the
time? Get [Link]
2:00
<file>
time
mobile network
enterprise
network
A closer look at Internet structure
mobile network
enterprise
network
A closer look at Internet structure
mobile network
Network edge: national or global ISP
- interconnected routers
- network of networks enterprise
network
The network edge:
❑ end systems (hosts):
▪ run application programs
▪ e.g. Web, email
▪ at “edge of network” peer-peer
❑ client/server model
▪ client host requests, receives
service from always-on server
client/server
▪ e.g. Web browser/server; email
client/server
❑ peer-peer model:
▪ minimal (or no) use of dedicated
servers
▪ e.g. Skype, BitTorrent
22
Network edge: reliable data transfer service
(connection-oriented)
Goal: data transfer TCP service [RFC 793]
between end systems ❑ reliable, in-order byte-
❑ handshaking: setup stream data transfer
(prepare for) data ▪ loss: acknowledgements and
transfer ahead of time retransmissions
▪ Hello, hello back human ❑ flow control:
protocol
▪ sender won’t overwhelm
▪ set up “state” in two receiver
communicating hosts
❑ congestion control:
❑ TCP - Transmission
▪ senders “slow down sending
Control Protocol rate” when network
▪ Internet’s reliable data congested
transfer service
23
Network edge: best effort (unreliable) data
transfer service (connectionless)
Goal: data transfer App’s using TCP:
between end systems ❑ HTTP (Web), FTP (file
▪ same as before! transfer), Telnet (remote
❑ UDP - User Datagram login), SMTP (email)
Protocol [RFC 768]:
Internet’s connectionless
service
App’s using UDP:
❑ streaming media,
▪ unreliable data
transfer teleconferencing, DNS,
Internet telephony
▪ no flow control
▪ no congestion control
24
Comp416/Elec416
Computer Networks
Notes 5
Layering, encapsulation, service models
Protocol “layers” and reference models
Networks are complex, Question: is there any
with many “pieces”: hope of organizing
hosts structure of network?
routers and/or our discussion
links of various media of networks?
applications
protocols
hardware, software
Example: organization of air travel
end‐to‐end transfer of person plus baggage
ticket (purchase) ticket (complain)
baggage (check) baggage (claim)
gates (load) gates (unload)
runway takeoff runway landing
airplane routing airplane routing
airplane routing
source destination
Services, Layering and Encapsulation
M
application application
Ht M
transport Transport‐layer protocol transfers M (e.g., reliably) from transport
one process to another, using services of network layer
network Hn Ht M network
Network‐layer protocol transfers transport‐layer segment
[Ht | M] from one host to another, using link layer services
link link
network‐layer protocol encapsulates
transport‐layer segment [Ht | M] with
physical network layer‐layer header Hn to create a physical
network‐layer datagram
source • Hn used by network layer protocol to destination
implement its service
Services, Layering and Encapsulation
M
application application
Ht M
transport transport
network Hn Ht M network
Network‐layer protocol transfers transport‐layer segment
[Ht | M] from one host to another, using link layer services
link Hl Hn Ht M link
Link‐layer protocol transfers datagram [Hn| [Ht |M] from
host to neighboring host, using physical‐layer services
physical physical
link‐layer protocol encapsulates network
datagram [Hn| [Ht |M], with link‐layer header
source Hl to create a link‐layer frame destination
Services, Layering and Encapsulation
M
application M application
message
Ht M
transport Ht M transport
segment
network Hn Ht M Hn Ht M network
datagram
link Hl Hn Ht M Hl Hn Ht M link
frame
physical physical
source destination
message M
source
application
Encapsulation: an
segment Ht
datagram Hn Ht
M transport
network
end‐end view
M
frame Hl Hn Ht M link
physical
link
physical
switch
destination Hn Ht M network
M application Hl Hn Ht M link Hn Ht M
Ht M transport physical
Hn Ht M network
Hl Hn Ht M link router
physical
Networks under attack
Network security
Internet not originally designed with (much) security in
mind
• original vision: “a group of mutually trusting users attached to a
transparent network”
• Internet protocol designers playing “catch‐up”
• security considerations in all layers!
We now need to think about:
• how bad guys can attack computer networks
• how we can defend networks against attacks
• how to design architectures that are immune to attacks
Bad guys: packet interception
packet “sniffing”:
broadcast media (shared Ethernet, wireless)
promiscuous network interface reads/records all packets (e.g.,
including passwords!) passing by
A C
A C
B
Bad guys: denial of service
Denial of Service (DoS): attackers make resources (server,
bandwidth) unavailable to legitimate traffic by
overwhelming resource with bogus traffic
1. select target
2. break into hosts
around the network
(see botnet)
3. send packets to target target
from compromised
hosts
Lines of defense:
authentication: proving you are who you say you are
• cellular networks provides hardware identity via SIM card; no such
hardware assist in traditional Internet
confidentiality: via encryption
integrity checks: digital signatures prevent/detect tampering
access restrictions: password‐protected VPNs
firewalls: specialized “middleboxes” in access and core
networks:
off‐by‐default: filter incoming packets to restrict senders, receivers,
applications
detecting/reacting to DOS attacks
Comp416/Elec416
Computer Networks
Notes 4
▪ Performance: loss, delay, throughput
How do packet delay and loss occur?
▪ packets queue in router buffers, waiting for turn for transmission
▪ queue length grows when arrival rate to link (temporarily) exceeds output link
capacity
▪ packet loss occurs when memory to hold queued packets fills up
packet being transmitted (transmission delay)
B
packets in buffers (queueing delay)
free (available) buffers: arriving packets
dropped (loss) if no free buffers
Packet delay: four sources
transmission
A propagation
B
nodal
processing queueing
B
nodal
processing queueing
3 probes 3 probes
3 probes
Real Internet delays and routes
traceroute: [Link] to [Link]
3 delay measurements from
[Link] to [Link]
1 cs-gw ([Link]) 1 ms 1 ms 2 ms 3 delay measurements
2 [Link] ([Link]) 1 ms 1 ms 2 ms
3 [Link] ([Link]) 6 ms 5 ms 5 ms to [Link]
4 [Link] ([Link]) 16 ms 11 ms 13 ms
5 [Link] ([Link]) 21 ms 18 ms 18 ms
6 [Link] ([Link]) 22 ms 18 ms 22 ms
7 [Link] ([Link]) 22 ms 22 ms 22 ms trans-oceanic link
8 [Link] ([Link]) 104 ms 109 ms 106 ms
9 [Link] ([Link]) 109 ms 102 ms 104 ms
10 [Link] ([Link]) 113 ms 121 ms 114 ms looks like delays
11 [Link] ([Link]) 112 ms 114 ms 112 ms
12 [Link] ([Link]) 111 ms 114 ms 116 ms decrease! Why?
13 [Link] ([Link]) 123 ms 125 ms 124 ms
14 [Link] ([Link]) 126 ms 126 ms 124 ms
15 [Link] ([Link]) 135 ms 128 ms 133 ms
16 [Link] ([Link]) 126 ms 128 ms 126 ms
17 * * *
18 * * * * means no response (probe lost, router not replying)
19 [Link] ([Link]) 132 ms 128 ms 136 ms
B
packet arriving to
full buffer is lost
* Check out the Java applet for an interactive animation (on publisher’s website) of queuing and loss
Throughput
▪ throughput: rate (bits/time unit) at which bits are being sent from
sender to receiver
• instantaneous: rate at given point in time
• average: rate over longer period of time
link capacity
pipe that can carry linkthat
pipe capacity
can carry
Rsfluid
bits/sec
at rate Rfluid
c bits/sec
at rate
serverserver,
sends with
bits
(fluid) into pipe (Rs bits/sec) (Rc bits/sec)
file of F bits
to send to client
Throughput
Rs < Rc What is average end-end throughput?
Rs bits/sec Rc bits/sec
Rs bits/sec Rc bits/sec
bottleneck link
link on end-end path that constrains end-end throughput
Throughput: network scenario
▪ per-connection end-
Rs end throughput:
Rs Rs min(Rc,Rs,R/10)
▪ in practice: Rc or Rs is
R often bottleneck
Rc Rc
Rc
* Check out the online interactive exercises for more
examples: [Link]
Comp416/Elec416
Computer Networks
Notes 2
Network edge:
Access networks and physical media
Access networks and physical media
Q: How to connect end systems mobile network
national or global ISP
to edge router?
▪ residential access nets
▪ institutional access networks (school,
company)
local or
▪ mobile access networks (WiFi, 4G/5G) regional ISP
enterprise
network
Access networks: cable-based access
cable headend
cable splitter
modem
C
O
V V V V V V N
I I I I I I D D T
D D D D D D A A R
E E E E E E T T O
O O O O O O A A L
1 2 3 4 5 6 7 8 9
Channels
DSL splitter
modem DSLAM
to/from headend or
central office
often combined
in single box
to Internet
to Internet
Access networks: enterprise networks
Enterprise link to
ISP (Internet)
institutional router
Ethernet institutional mail,
switch web servers
local or
regional ISP
Comp416/Elec416
Computer Networks
Notes 3
Network core:
packet/circuit switching
internet structure
The network core
▪ mesh of interconnected routers mobile network
national or global ISP
▪ packet-switching: hosts break
application-layer messages into
packets
• network forwards packets from one local or
regional ISP
router to the next, across links on
path from source to destination home network content
provider
network datacenter
network
enterprise
network
Two key network-core functions
L bits
per packet
3 2 1
source destination
R bps R bps
D
B R = 1.5 Mb/s
E
queue of packets
waiting for transmission
over output link
D
B R = 1.5 Mb/s
E
queue of packets
waiting for transmission
over output link
Packet queuing and loss: if arrival rate (in bps) to link exceeds
transmission rate (bps) of link for some period of time:
▪ packets will queue, waiting to be transmitted on output link
▪ packets can be dropped (lost) if memory (buffer) in router fills up
Alternative to packet switching: circuit switching
end-end resources allocated to,
reserved for “call” between source
and destination
▪ in diagram, each link has four circuits.
• call gets 2nd circuit in top link and 1st
circuit in right link.
▪ dedicated resources: no sharing
• circuit-like (guaranteed) performance
▪ circuit segment idle if not used by call (no
sharing)
▪ commonly used in traditional telephone networks
* Check out the online interactive exercises for more examples: [Link]
Circuit switching: FDM and TDM
Frequency Division Multiplexing
(FDM) 4 users
frequency
▪ optical, electromagnetic frequencies
divided into (narrow) frequency
bands
▪ each call allocated its own band, can
transmit at max rate of that narrow time
band
frequency
▪ time divided into slots
▪ each call allocated periodic slot(s), can
transmit at maximum rate of (wider) time
frequency band (only) during its time
slot(s)
Packet switching versus circuit switching
example:
▪ 1 Gb/s link
N
▪ each user: users 1 Gbps link
• 100 Mb/s when “active”
• active 10% of time
Q: how many users can use this network under circuit-switching and packet switching?
▪ circuit-switching: 10 users
▪ packet switching: with 35 users, Q: how did we get value 0.0004?
probability > 10 active at same time
is less than .0004 *
* Check out the online interactive exercises for more examples: [Link]
Packet switching versus circuit switching
Is packet switching a “slam dunk winner”?
▪ great for “bursty” data – sometimes has data to send, but at other times not
• resource sharing
• simpler, no call setup
▪ excessive congestion possible: packet delay and loss due to buffer overflow
• protocols needed for reliable data transfer, congestion control
▪ Q: How to provide circuit-like behavior with packet-switching?
• “It’s complicated.” We’ll study various techniques that try to make packet
switching as “circuit-like” as possible.
access access
net net
access
net
access
net
access
net
access
net
access access
net access net
net
Internet structure: a “network of networks”
Question: given millions of access ISPs, how to connect them together?
access access
net net
access
net
access
access net
net
access
access net
net
access
net
access
net
access
net
access
net
access access
net access net
net
Internet structure: a “network of networks”
Option: connect each access ISP to one global transit ISP?
Customer and provider ISPs have economic agreement.
access access
net net
access
net
access
access net
net
access
access net
net
global
access
net
ISP access
net
access
net
access
net
access
net
access
net
access access
net access net
net
Internet structure: a “network of networks”
But if one global ISP is viable business, there will be competitors ….
access access
net net
access
net
access
access net
net
access
access net
net ISP A
access
net ISP B access
net
access ISP C
net
access
net
access
net
access
net
access access
net access net
net
Internet structure: a “network of networks”
But if one global ISP is viable business, there will be competitors …. who will
want to be connected
Internet exchange point
access access
net net
access
net
access
access net
net
IXP access
access net
net ISP A
access
net
IXP ISP B access
net
access ISP C
net
access
net
access
net
peering link
access
net
access access
net access net
net
Internet structure: a “network of networks”
… and regional networks may arise to connect access nets to ISPs
access access
net net
access
net
access
access net
net
IXP access
access net
net ISP A
access
net
IXP ISP B access
net
access ISP C
net
access
net
access
net
regional ISP access
net
access access
net access net
net
Internet structure: a “network of networks”
… and content provider networks (e.g., Google, Microsoft, Akamai) may
run their own network, to bring services, content close to end users
access access
net net
access
net
access
access net
net
IXP access
access net
net ISP A
access ISP C
net
access
net
access
net
regional ISP access
net
access access
net access net
net
Internet structure: a “network of networks”
Tier 1 ISP Tier 1 ISP Google
IXP IXP IXP
Regional ISP Regional ISP
POP: point-of-presence
to/from other Sprint PoPS
links to peering
networks
…
… … …
links to/from Sprint customer networks