Lecture 7 (CN)
Lecture 7 (CN)
Lecture 7
September 10, 2024 (Tuesday)
Application layer: overview
P2P applications
Principles of network video streaming and content
applications distribution networks
Web and HTTP socket programming with
E-mail, SMTP, IMAP UDP and TCP
The Domain Name System
DNS
time time
Non-persistent HTTP response time = 2RTT+ file transmission time
Application Layer: 2-9
Persistent HTTP (HTTP 1.1)
Non-persistent HTTP issues: Persistent HTTP (HTTP1.1):
requires 2 RTTs per object server leaves connection open after
OS overhead for each TCP sending response
connection subsequent HTTP messages
browsers often open multiple between same client/server sent
parallel TCP connections to over open connection
fetch referenced objects in client sends requests as soon as it
parallel encounters a referenced object
as little as one RTT for all the
referenced objects (cutting
response time in half)
Application Layer: 2-10
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 /index.html HTTP/1.1\r\n
HEAD commands) Host: www-net.cs.umass.edu\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: http://gaia.cs.umass.edu/kurose_ross/interactive/ Application Layer: 2-11
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
* Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/
Application Layer: 2-14
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
Application Layer: 2-15
Trying out HTTP (client side) for yourself
1. netcat to your favorite Web server:
% nc -c -v gaia.cs.umass.edu 80 opens TCP connection to port 80 (default HTTP server
port) at gaia.cs.umass. edu.
anything typed in will be sent to port 80 at
gaia.cs.umass.edu
2. type in a GET HTTP request:
GET /kurose_ross/interactive/index.php HTTP/1.1
Host: gaia.cs.umass.edu
by typing this in (hit carriage return twice), you send
this minimal (but complete) GET request to HTTP
server
lower average end-end delay than with 154 Mbps link (and cheaper too!)
Application Layer: 2-26
Conditional GET
client server
in HTTP request
If-modified-since: <date>
server: response contains no HTTP request msg
If-modified-since: <date> object
object if cached copy is up-to-date: modified
HTTP/1.0 304 Not Modified HTTP response after
HTTP/1.0 200 OK <date>
<data>
O1
O2
O1 O3
O2
O3
O4
O4
objects delivered in order requested: O2, O3, O4 wait behind O1 Application Layer: 2-30
HTTP/2: mitigating HOL blocking
HTTP/2: objects divided into frames, frame transmission interleaved
server
O2
O3
O1
O4