Persistent HTTP non-persistent HTTP persistent HTTP: issues: server leaves requires 2 RTTs per connection open after object sending response OS overhead for each subsequent HTTP TCP connection messages between browsers often open same client/server sent parallel TCP connections over open connection to fetch referenced :client sends requests as objects soon as it encounters a referenced object as little as one RTT for all the referenced objects Application Layer 2-26
Application Layer 2-26 Persistent HTTP non-persistent HTTP issues: requires 2 RTTs per object OS overhead for each TCP connection browsers often open parallel TCP connections to fetch referenced objects persistent HTTP: server leaves connection open after sending response subsequent HTTP messages between same client/server sent over open connection client sends requests as soon as it encounters a referenced object as little as one RTT for all the referenced objects
HTTP request message two types of HTTP messages:request,response HTTP request message: ASCIl (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.edur\n User-Agent:Firefox/3.6.10\r\n header Accept:text/html,application/xhtml+xml\r\n Accept-Language:en-us,en;q=0.5\r\n lines Accept-Encoding:gzip,deflater\n Accept-Charset:ISO-8859-1,utf-8;q=0.7\r\n carriage return, Keep-Alive:115\r\n line feed at start Connection:keep-alive\r\n Ir\n of line indicates end of header lines Application Layer 2-27
Application Layer 2-27 HTTP request message two types of HTTP messages: request, response HTTP request message: ASCII (human-readable format) request line (GET, POST, HEAD commands) header lines carriage return, line feed at start of line indicates end of header lines 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 carriage return character line-feed character
HTTP request message:general format method sp URL sp version cr request line header field name value cr If header lines header field name value cr If cr f entity body body Application Layer 2-28
Application Layer 2-28 HTTP request message: general format request line header lines body method sp URL sp version cr lf header field name value cr lf header field name value cr lf ~~ ~~ cr lf ~ entity body ~ ~~
Uploading form input POST method: web page often includes form input input is uploaded to server in entity body URL method: ÷uses GET method input is uploaded in URL field of request line: www.somesite.com/animalsearch?monkeys&banana Application Layer 2-29
Application Layer 2-29 Uploading form input POST method: web page often includes form input input is uploaded to server in entity body URL method: uses GET method input is uploaded in URL field of request line: www.somesite.com/animalsearch?monkeys&banana
Method types HTTP/1.0: HTTP/1.1: GET GET,POST,HEAD POST ÷PUT HEAD uploads file in entity ■asks server to leave body to path requested object out specified in URL field of response ÷DELETE deletes file specified in the URL field Application Layer 2-30
Application Layer 2-30 Method types HTTP/1.0: GET POST HEAD asks server to leave requested object out of response HTTP/1.1: GET, POST, HEAD PUT uploads file in entity body to path specified in URL field DELETE deletes file specified in the URL field