EE 122: Lecture 21 (HyperText Transfer Protocol - HTTP)BackgroundBasicsTerminologyUniversal Resource LocatorClient RequestServer ResponseBig PictureRequest MethodsResponse CodesHTTP/1.0 ExampleHHTP/1.0 PerformanceWeb ProxiesWeb Proxies (cont’d)HTTP/1.0 CachingHTTP/1.1Persistent ConnectionsPipelined Requests/ResponsesChunked Transfer EncodingCompression of Data TypesSupport for Virtual HostingHTTP/1.1 - CachingHTTP/1.1 - Caching (cont’d)Slide 24HTTP/1.1 – Caching (cont’d)SummaryEE 122: Lecture 21(HyperText Transfer Protocol - HTTP)Ion StoicaNov 20, 2001(*)[email protected] 2BackgroundWorld Wide Web (WWW): a set of cooperating clients and servers that communicate through HTTPHTTP history-First HTTP implementation - 1990 •Tim Berners-Lee at CERN-HTTP/0.9 – 1991•Simple GET command for the Web-HTTP/1.0 –1992•Client/Server information, simple caching-HTTP/1.1 - [email protected] 3BasicsClient-server architectureSynchronous request/reply protocol StatelessUses unicastImplemented on top of TCP/[email protected] 4TerminologyResource – file or service (e.g., dynamic results from the execution of a script)Entity – information transferred in a request or responseEntity Tag – unique identifier for a [email protected] 5Universal Resource LocatorAn address or location of a resource, e.g., http://www.eecs.berkeley.edu/index.html Prefix up to “:” represents the protocol to be used to obtain the [email protected] 6Client RequestSteps to get the resource: http://www.eecs.berkeley.edu/index.html 1. Use DNS to obtain the IP address of www.eecs.berkeley.edu, A2. Send to A an HTTP request:3. Server response: (see next slide)GET /index.html HTTP/[email protected] 7Server ResponseHTTP/1.0 200 OKContent-Type: text/htmlContent-Length: 1234Last-Modified: Mon, 19 Nov 2001 15:31:20 GMT<HTML><HEAD><TITLE>EECS Home Page</TITLE></HEAD>…</BODY></HTML>[email protected] 8Big PictureClientServerTCP SynTCP syn + ack TCP ack + HTTP GET...EstablishconnectionRequestresponseClient [email protected] 9Request MethodsGET – transfer resource from given URLHEAD – GET resource metadata (headers) onlyPUT – store/modify resource under the given URLDELETE – remove resourcePOST – provide input for a process identified by the given URL (usually used to post CGI parameters)[email protected] 10Response Codes1x informational2x success3x redirection4x client error in request5x server error; can’t satisfy the [email protected] 11HTTP/1.0 ExampleClientServerRequest image 1Transfer image 1Request image 2Transfer image 2Request textTransfer textFinish [email protected] 12HHTP/1.0 PerformanceCreate a new TCP connection for each resource-Large number of embedded objects in a web page-Many short lived connectionsTCP transfer-Too slow for small object-May never exit slow-start [email protected] 13Web ProxiesIntermediaries between client and serverClient 1Proxy Proxy ServerClient 2Client [email protected] 14Web Proxies (cont’d)Location: close to the server, client, or in the networkFunctions:-Filter requests/responses-Modify requests/responses•Change http requests to ftp requests•Change response content, e.g., transcoding to display data efficiently on a Palm Pilot -Provide better [email protected] 15HTTP/1.0 CachingA request directive: -Pragma: no-cache – ignore all caches and get resource directly from serverA modifier to the GET request:-If-modified-since – return a “not modified” response if resource was not modified since specified time A response header:-Expires – specify to the client for how long it is safe to cache the [email protected] 16HTTP/1.1Performance: -Persistent connections -Pipelined requests/responses-Chunked transfer encoding-Compression of data types-…Support for virtual hostingEfficient caching [email protected] 17Persistent ConnectionsAllow multiple transfers over one connectionAvoid multiple TCP connection setupsAvoid multiple TCP slow [email protected] 18Pipelined Requests/ResponsesBuffer requests and responses to reduce the number of packetsMultiple requests can be contained in one TCP segmentNote: order of responses has to be maintainedClientServerRequest 1Request 2Request 3Transfer 1Transfer 2Transfer [email protected] 19Chunked Transfer EncodingIn HTTP/1.0 server indicate the end of dynamic content by closing connection-Persistent connections not possible! Why?In HTTP/1.1 server splits dynamic content in chunksSize of chunk in hex followed by semicolon-Dynamic content transfer: series of chunks followed by a chunk of size [email protected] 20Compression of Data TypesEnables transport compression of data types to decrease payload sizeExample:-Server sends in response: “Content-Encoding: gzip”-Client sends: “Accept-Encoding:gzip”[email protected] 21Support for Virtual Hosting Problem: recall that a request to get http://www.foo.com/index.html has in its header only:-GET /index.html HTTP/1.0It is not possible to run two web servers at the same IP address, because GET is ambiguous-This is useful when outsourcing web content, i.e., company “foo” asks company “outsource” to manage its contentHTTP/1.1 addresses this problem by mandating “Host” header line, e.g., GET /index.html HTTP/1.1Host: [email protected] 22HTTP/1.1 - CachingHTTP/1.1 provides better support for caching-Separate “what to cache” and “whether a cache response can be used safely”-Allow server to provide more info on resource cacheability -A cache does not return unknowingly a stale resources-Not depending on absolute [email protected] 23HTTP/1.1 - Caching (cont’d)Four new headers associated to caching: age header, entity tags, cache-control, and varyAge Header – the amount of time that is known to have passed since the response message was retrieved Entity tags – unique tags to differentiate between different cached versions of the same [email protected] 24HTTP/1.1 - Caching (cont’d)Cache-Control-no-cache: get resource only from server-only-if-cached: obtain resource only from cache-no-store: don’t allow caches to store
View Full Document