diff --git a/http-web-services.html b/http-web-services.html index 59a2a66..b72a875 100755 --- a/http-web-services.html +++ b/http-web-services.html @@ -219,7 +219,7 @@ reply: 'HTTP/1.1 200 OK' …further debugging information omitted…
urllib.request relies on another standard Python library, http.client. Normally you don’t need to touch http.client directly. (The urllib.request module imports it automatically.) But we import it here so we can toggle the debugging flag on the HTTPConnection class that urllib.request uses to connect to the HTTP server.
-urllib.request module sends five lines to the server.
+urllib.request module sends five lines to the server.
urllib.request does not support compression by default.
@@ -451,7 +451,7 @@ reply: 'HTTP/1.1 200 OK'
httplib2 Handles Last-Modified and ETag HeadersThe Cache-Control and Expires caching headers are called freshness indicators. They tell caches in no uncertain terms that you can completely avoid all network access until the cache expires. And that’s exactly the behavior you saw in the previous section: given a strong validator, httplib2 does not generate a single byte of network activity to serve up cached data (unless you explicitly bypass the cache, of course).
+
The Cache-Control and Expires caching headers are called freshness indicators. They tell caches in no uncertain terms that you can completely avoid all network access until the cache expires. And that’s exactly the behavior you saw in the previous section: given a freshness indicator, httplib2 does not generate a single byte of network activity to serve up cached data (unless you explicitly bypass the cache, of course).
But what about the case where the data might have changed, but hasn’t? HTTP defines Last-Modified and Etag headers for this purpose. These headers are called validators. If the local cache is no longer fresh, a client can send the validators with the next request to see if the data has actually changed. If the data hasn’t changed, the server sends back a 304 status code and no data. So there’s still a round-trip over the network, but you end up downloading fewer bytes.