flash service

High_Performance_Web_Sites

Issue link: https://read.uberflip.com/i/1146286

Contents of this Issue

Navigation

Page 29 of 169

8 | Chapter B: HTTP Overview If the component has not been modified since the specified date, the server returns a "304 Not Modified" status code and skips sending the body of the response, result- ing in a smaller and faster response. In HTTP/1.1 the ETag and If-None-Match head- ers are another way to make conditional GET requests. Both approaches are discussed in Chapter 13. Expires Conditional GET requests and 304 responses help pages load faster, but they still require making a roundtrip between the client and server to perform the validity check. The Expires header eliminates the need to check with the server by making it clear whether the browser can use its cached copy of a component. HTTP/1.1 200 OK Content-Type: application/x-javascript Last-Modified: Wed, 22 Feb 2006 04:15:54 GMT Expires: Wed, 05 Oct 2016 19:16:20 GMT When the browser sees an Expires header in the response, it saves the expiration date with the component in its cache. As long as the component hasn't expired, the browser uses the cached version and avoids making any HTTP requests. Chapter 3 talks about the Expires and Cache-Control headers in more detail. Keep-Alive HTTP is built on top of Transmission Control Protocol (TCP). In early implementa- tions of HTTP, each HTTP request required opening a new socket connection. This is inefficient because many HTTP requests in a web page go to the same server. For example, most requests for images in a web page all go to a common image server. Persistent Connections (also known as Keep-Alive in HTTP/1.0) was introduced to solve the inefficiency of opening and closing multiple socket connections to the same server. It lets browsers make multiple requests over a single connection. Browsers and servers use the Connection header to indicate Keep-Alive support. The Connection header looks the same in the server's response. GET /us.js.yimg.com/lib/common/utils/2/yahoo_2.0.0-b2.js HTTP/1.1 Host: us.js2.yimg.com User-Agent: Mozilla/5.0 (...) Gecko/20061206 Firefox/1.5.0.9 Accept-Encoding: gzip,deflate Connection: keep-alive HTTP/1.1 200 OK Content-Type: application/x-javascript Last-Modified: Wed, 22 Feb 2006 04:15:54 GMT Connection: keep-alive

Articles in this issue

Links on this page

Archives of this issue

view archives of flash service - High_Performance_Web_Sites