cs 471/571 application layer 2 figures from kurose and ross
TRANSCRIPT
Internet Transport Layer
• TCP– Connection oriented– Reliable data transfer
• UDP– Connectionless– Data loss possible– It is possible that packets are delivered out of
order
Internet Transport Layer
• No throughput guarantees• No delay guarantees• No security built into TCP or UDP• SSL
– Secure socket layer– Application layer services built on top of TCP
Application Layer Protocols
• Varies by application• Types of message exchange
– Request– Response
• Message Syntax– Fields
• Message Semantics• Rules about when messages should be sent
Overview
• Created in the early 1990s by Tim Berners-Lee• Client/Server Architecture
– http client/http server– Request/response
• Web Page– Web page consist of one or more objects
• URL: hostname/pathname– cs.uwlax.edu/~gendreau/cs471
• Stateless
Hypertext
• Vannevar Bush: Memex (1954)• Ted Nelson (1963)• Douglas Engelbart (1962)• Hypercard (MacIntosh 1987)
Request/Response
PC runningFirefox browser
server running
Apache Webserver
iphone runningSafari browser
HTTP requestHTTP response
HTTP request
HTTP response
Example Transfer
time to transmit file
initiate TCPconnection
RTT
requestfile
RTT
filereceived
time time
TCP three-way handshake
Example Request
request line(GET, POST, HEAD commands)
header lines
carriage return, line feed at startof line indicatesend of header lines
GET /index.html HTTP/1.1\r\nHost: www-net.cs.umass.edu\r\nUser-Agent: Firefox/3.6.10\r\nAccept: text/html,application/xhtml+xml\r\nAccept-Language: en-us,en;q=0.5\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: ISO-8859-1,utf-8;q=0.7\r\nKeep-Alive: 115\r\nConnection: keep-alive\r\n\r\n
Carriage returnline-feed character
Application Layer 2-13
HTTP request message: general format
requestline
headerlines
body
method sp sp cr lfversionURL
cr lfvalueheader field name
cr lfvalueheader field name
~~ ~~
cr lf
entity body~~ ~~
Application Layer 2-14
HTTP response message
status line(protocolstatus codestatus phrase)
header lines
data, e.g., requestedHTML file
HTTP/1.1 200 OK\r\nDate: Sun, 26 Sep 2010 20:09:20 GMT\r\nServer: Apache/2.0.52 (CentOS)\r\nLast-Modified: Tue, 30 Oct 2007 17:00:02
GMT\r\nETag: "17dc6-a5c-bf716880"\r\nAccept-Ranges: bytes\r\nContent-Length: 2652\r\nKeep-Alive: timeout=10, max=100\r\nConnection: Keep-Alive\r\nContent-Type: text/html; charset=ISO-8859-1\
r\n\r\ndata data data data data ...
Application Layer 2-15
HTTP response message: general format
statusline
headerlines
body
version sp sp cr lfphraseStatus code
cr lfvalueheader field name
cr lfvalueheader field name
~~ ~~
cr lf
entity body~~ ~~
sp
sp
Message Format
• Status codes– 200 OK:– 301 Moved Permanently– 400 Bad Request– 404 Not Found:– 505 HTTP Version Not Supported:
telnet examplePrompt> telnet cis.poly.edu 80Trying 128.238.32.126...Connected to cis.poly.edu.Escape character is '^]'.HEAD /~ross HTTP/1.1Host: cis.poly.edu
HTTP/1.1 301 Moved PermanentlyDate: Wed, 19 Feb 2014 16:48:38 GMTServer: Apache/1.2.5Location: http://cis.poly.edu/~ross/Content-Type: text/html
Connection closed by foreign host.Prompt>
Cookies
• Client maintains cookie file• Server maintains database matching id
number with information about the user • Once the id is established it can be included in
response messages
Application Layer 2-19
Cookies: keeping “state” (cont.)
client server
usual http response msg
usual http response msg
cookie file
one week later:
usual http request msgcookie: 1678 cookie-
specificaction
access
ebay 8734usual http request msg Amazon server
creates ID1678 for user create
entry
usual http response set-cookie: 1678
ebay 8734amazon 1678
usual http request msgcookie: 1678 cookie-
specificaction
access
ebay 8734amazon 1678
backenddatabase
Web Cache
client
proxyserver
client
HTTP request
HTTP response
HTTP request HTTP request
origin server
HTTP response HTTP response
File Transfer Protocol (ftp)
• Allows a use to sign in (an anonymous account can be used) and transfer files between the client machine and server machine
• ftp server listens on port 21• Uses TCP
– Separate control and data connection– Out-of-band control– http uses in-band control
• Maintains user state
ftpfile transfer
FTPserver
FTPuser
interface
FTPclient
local filesystem
remote filesystem
user at host
ftp Connections
FTPclient
FTPserver
TCP control connection,server port 21
TCP data connection,server port 20