Persistent HTTP non-persistent HTTP issues: persistent HTTP. requires 2 RTTs per object server leaves connection OS overhead for each TCP open after sending connection response ■browsers often open subsequent HTTP parallel TCP connections to messages between same fetch referenced objects 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 Application Layer2-26
Application Layer2-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: ASCll (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: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,deflate\r\n carriage return, Accept-Charset:ISO-8859-1,utf-8;q=0.7\r\n line feed at start Keep-Alive:115\r\n of line indicates Connection:keep-alive\r\n +\r\n end of header lines Check out the online interactive exercises for more examples:http://gaia.cs.umass.edu/kurose_ross/interactive/ Application Layer2-27
Application Layer2-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 * Check out the online interactive exercises for more examples: http://gaia.cs.umass.edu/kurose_ross/interactive/
HTTP request message:general format method sp URL sp version cr f request line header field name value cr If header lines header field name value cr f cr If entity body body Application Layer2-28
Application Layer2-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 Layer2-29
Application Layer2-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/I.I: 。GET GET,POST,HEAD POST PUT HEAD uploads file in entity ·asks server to leave body to path specified requested object out in URL field of response ·DELETE deletes file specified in the URL field Application Layer2-30
Application Layer2-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