Week 2-Lec2 HTTP
Week 2-Lec2 HTTP
Week 2-Lec2 HTTP
enterprise
network
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
application application
socket controlled by
process process app developer
transport transport
network network controlled
link by OS
link Internet
physical physical
time time
Non-persistent HTTP response time = 2RTT+ file transmission time
Application Layer: 2-21
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-22
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-23
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-26
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-27