Application Layer 2 Figures from Kurose and Ross CS 471/571 Application Layer 2 Figures from Kurose and Ross
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
HyperText Transfer Protocol (http) Overview Connections Message Format Cookies Web Caching
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 HTTP request PC running Firefox browser HTTP response server running Apache Web iphone running Safari browser
Connections TCP connections Persistent Non-Persistent
Example Transfer TCP three-way handshake initiate TCP connection RTT request file time to transmit file RTT file received time time
Message Format Syntax Semantics Standard ASCII Text Methods GET POST HEAD PUT DELETE
Example Request request line (GET, POST, HEAD commands) header lines Carriage return line-feed character request line (GET, POST, HEAD commands) GET /index.html HTTP/1.1\r\n Host: www-net.cs.umass.edu\r\n User-Agent: Firefox/3.6.10\r\n Accept: text/html,application/xhtml+xml\r\n Accept-Language: en-us,en;q=0.5\r\n Accept-Encoding: gzip,deflate\r\n Accept-Charset: ISO-8859-1,utf-8;q=0.7\r\n Keep-Alive: 115\r\n Connection: keep-alive\r\n \r\n header lines carriage return, line feed at start of line indicates end of header lines
HTTP request message: general format sp request line method URL sp version cr lf cr lf value header field name header lines ~ ~ cr lf value header field name cr lf ~ entity body ~ body Application Layer
HTTP response message status line (protocol status code status phrase) HTTP/1.1 200 OK\r\n Date: Sun, 26 Sep 2010 20:09:20 GMT\r\n Server: Apache/2.0.52 (CentOS)\r\n Last-Modified: Tue, 30 Oct 2007 17:00:02 GMT\r\n ETag: "17dc6-a5c-bf716880"\r\n Accept-Ranges: bytes\r\n Content-Length: 2652\r\n Keep-Alive: timeout=10, max=100\r\n Connection: Keep-Alive\r\n Content-Type: text/html; charset=ISO-8859-1\r\n \r\n data data data data data ... header lines data, e.g., requested HTML file Application Layer
HTTP response message: general format version sp Status code sp phrase cr status line lf cr lf value header field name sp header lines ~ ~ cr lf value header field name sp cr lf ~ entity body ~ body Application Layer
Message Format Status codes 200 OK: 301 Moved Permanently 400 Bad Request 404 Not Found: 505 HTTP Version Not Supported:
telnet example Prompt> telnet cis.poly.edu 80 Trying 128.238.32.126... Connected to cis.poly.edu. Escape character is '^]'. HEAD /~ross HTTP/1.1 Host: cis.poly.edu HTTP/1.1 301 Moved Permanently Date: Wed, 19 Feb 2014 16:48:38 GMT Server: Apache/1.2.5 Location: 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
Cookies: keeping “state” (cont.) client server ebay 8734 usual http request msg Amazon server creates ID 1678 for user create entry cookie file usual http response set-cookie: 1678 ebay 8734 amazon 1678 backend database usual http request msg cookie: 1678 cookie- specific action access usual http response msg usual http request msg cookie: 1678 cookie- specific action access one week later: ebay 8734 amazon 1678 usual http response msg Application Layer
Web Cache Proxy Server Conditional Get
Web Cache proxy server HTTP request client HTTP response origin server
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
ftp file transfer FTP user FTP interface client server user at host remote file system local file system
TCP control connection, ftp Connections TCP control connection, server port 21 TCP data connection, server port 20 FTP client FTP server
ftp Commands Data transferred in plain text User username PASS password List RETR filename (get) STOR filename (put)