Lecture 05 Application Layer Part 01
Lecture 05 Application Layer Part 01
Application
Layer
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
permanent IP address
often in data centers, for scaling
clients: local or
contact, communicate with server regional ISP
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
peers are intermittently connected network
Sockets(Software Interface) on the application layer side of the socket but has litt
control of the transport-layer side of the socket.
time time
Non-persistent HTTP response time = 2RTT+ file transmission time
Application Layer: 2-26
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-27
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-28
HTTP Request message
The first line of an HTTP request message is called the request line; the subsequent lines are
called the header lines. The request line has three fields: the method field, the URL field, and
the HTTP version field.
The method field can take on several different values, including GET, POST, HEAD, PUT, and
DELETE . The great majority of HTTP request messages use the GET method.
The GET method is used when the browser requests an object, with the requested object
identified in the URL field.
In this example,
the browser is requesting the object
/somedir/page.html .
~
~ entity body ~
~ body
• The PUT method is often used in conjunction with Web publishing tools. It allows a user to upload an object
to a specific path (directory) on a specific Web server.
• The PUT method is also used by applications that need to upload objects to Web servers.
• The DELETE method allows a user, or an application, to delete an object on a Web server.
• An HTTP client often uses the POST method when the user fills out a form—for example, when a user provides search
words to a search engine.
• With a POST message, the user is still requesting a Web page from the server, but the specific contents of the Web page
* Check out the online interactive exercises for more examples: h ttp://gaia.cs.umass.edu/kurose_ross/interactive/
Application Layer: 2-33
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-34