• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:no +full:- +full:cache

24 cacheDirName = ".cache"
85 "http://example.org/", httplib2.urlnorm("http://example.org")[-1]
88 "http://example.org/", httplib2.urlnorm("http://EXAMple.org")[-1]
91 "http://example.org/?=b", httplib2.urlnorm("http://EXAMple.org?=b")[-1]
95 httplib2.urlnorm("http://EXAMple.org/mypath?a=b")[-1],
98 "http://localhost:80/", httplib2.urlnorm("http://localhost:80")[-1]
106 self.fail("Non-absolute URIs should raise an exception")
127 httplib2.safename(httplib2.urlnorm("http://www")[-1]),
128 httplib2.safename(httplib2.urlnorm("http://WWW")[-1]),
147 "xn--http,-4y1d.org,fred,a=b,579924c35db315e5a32e3d9963388193",
272 self.assertEqual(response["content-location"], "http://bitworking.org")
301 self.assertEqual(response["content-type"], "text/plain")
317 self.assertEqual(response["content-type"], "text/plain")
335 self.assertEqual(response["x-method"], "GET")
342 self.assertEqual(response["x-method"], method)
355 # Test that can do a GET w/o the cache turned on.
363 # Test that can do a GET with cache and 'only-if-cached'
367 uri, "GET", headers={"cache-control": "only-if-cached"}
373 # Test that can do a GET with no cache with 'only-if-cached'
376 uri, "GET", headers={"cache-control": "only-if-cached"}
382 # Test that can do a GET with no cache with 'only-if-cached'
384 # that responds to the 'only-if-cached', so this
389 uri, "GET", headers={"cache-control": "only-if-cached"}
395 # Test that we provide a default user-agent
396 uri = urllib.parse.urljoin(base, "user-agent/test.cgi")
399 self.assertTrue(content.startswith(b"Python-httplib2/"))
402 # Test that the default user-agent can be over-ridden
404 uri = urllib.parse.urljoin(base, "user-agent/test.cgi")
406 uri, "GET", headers={"User-Agent": "fred/1.0"}
413 uri = urllib.parse.urljoin(base, "300/with-location-header.asis")
430 uri = urllib.parse.urljoin(base, "300/with-location-header.asis")
437 uri = urllib.parse.urljoin(base, "300/without-location-header.asis")
440 self.assertTrue(response["content-type"].startswith("text/html"))
445 # and that we cache the 301 response
447 destination = urllib.parse.urljoin(base, "302/final-destination.txt")
450 self.assertTrue("content-location" in response)
451 self.assertEqual(response["content-location"], destination)
458 self.assertEqual(response["content-location"], destination)
473 # and that we cache the 301 response
476 destination = urllib.parse.urljoin(base, "302/final-destination.txt")
482 # and that we DO NOT cache the 302 response
484 destination = urllib.parse.urljoin(base, "302/final-destination.txt")
487 self.assertEqual(response["content-location"], destination)
496 self.assertEqual(response["content-location"], destination)
500 self.assertEqual(response.previous["content-location"], uri)
526 # Re-run the test with out the exceptions
538 # a 302 with no Location: header.
540 uri = urllib.parse.urljoin(base, "302/no-location.asis")
549 # Re-run the test with out the exceptions
613 # Test that we get an ssl.SSLError when specifying a non-existent CA
634 # Do a follow-up GET on a Location: header
643 # Do a follow-up GET on a Location: header
652 uri = urllib.parse.urljoin(base, "303/redirect-to-reflector.cgi")
661 self.assertEqual(response["x-method"], method_on_303)
664 # Test that we use ETags properly to validate our cache
667 uri, "GET", headers={"accept-encoding": "identity"}
672 uri, "GET", headers={"accept-encoding": "identity"}
677 headers={"accept-encoding": "identity", "cache-control": "must-revalidate"},
683 cacheDirName, httplib2.safename(httplib2.urlnorm(uri)[-1])
692 uri, "HEAD", headers={"accept-encoding": "identity"}
698 uri, "GET", headers={"accept-encoding": "identity", "range": "bytes=0-0"}
707 uri, "GET", headers={"accept-encoding": "identity"}
714 headers={"accept-encoding": "identity", "cache-control": "max-age=0"},
723 headers={"accept-encoding": "identity", "cache-control": "max-age=0"},
733 uri, "GET", headers={"accept-encoding": "identity"}
740 headers={"accept-encoding": "identity", "cache-control": "max-age=0"},
750 "accept-encoding": "identity",
751 "cache-control": "max-age=0",
752 "if-none-match": "fred",
759 # MAP-commented this out because it consistently fails
761 # # Test that end to end headers get overwritten in the cache
768 …# (response, content) = self.http.request(uri, "GET", headers = {'Cache-Control': 'max-age=…
769 # # The response should be from the cache, but the Date: header should be updated.
777 # by only using the last-modified cache validator.
779 base, "304/last-modified-only/last-modified-only.txt"
783 self.assertNotEqual(response["last-modified"], "")
791 # do not cache the 307
813cache receives a subsequent request whose Request-URI specifies one or more cache entries includin…
824 # get the resource again, from the cache since accept header in this
830 self.assertEqual(response.fromcache, True, msg="Should be from cache")
832 # get the resource again, not from cache since Accept headers does not match
837 self.assertEqual(response.fromcache, False, msg="Should not be from cache")
839 # get the resource again, without any Accept header, so again no match
842 self.assertEqual(response.fromcache, False, msg="Should not be from cache")
846 # when there is no vary, a different Accept header (e.g.) should not
847 # impact if the cache is used
849 # uri = urllib.parse.urljoin(base, "vary/no-vary.asis")
856 # self.assertEqual(response.fromcache, True, msg="Should be from cache")
860 # self.assertEqual(response.fromcache, True, msg="Should be from cache")
863 uri = urllib.parse.urljoin(base, "vary/accept-double.asis")
869 "Accept-Language": "da, en-gb;q=0.8, en;q=0.7",
875 # we are from cache
881 "Accept-Language": "da, en-gb;q=0.8, en;q=0.7",
884 self.assertEqual(response.fromcache, True, msg="Should be from cache")
892 # get the resource again, not from cache, varied headers don't match exact
894 uri, "GET", headers={"Accept-Language": "da"}
897 self.assertEqual(response.fromcache, False, msg="Should not be from cache")
901 uri = urllib.parse.urljoin(base, "vary/unused-header.asis")
908 # we are from cache
912 self.assertEqual(response.fromcache, True, msg="Should be from cache")
916 uri = urllib.parse.urljoin(base, "gzip/final-destination.txt")
919 self.assertNotEqual(int(response["content-length"]), 0)
924 uri = urllib.parse.urljoin(base, "gzip/final-destination.txt")
927 self.assertFalse("content-encoding" in response)
928 self.assertTrue("-content-encoding" in response)
930 int(response["content-length"]), len(b"This is the final destination.\n")
938 self.assertFalse("content-encoding" in response)
939 self.assertTrue("-content-encoding" in response)
944 uri = urllib.parse.urljoin(base, "gzip/failed-compression.asis")
953 # Re-run the test with out the exceptions
975 self.assertFalse("content-encoding" in response)
977 int(response["content-length"]), len("This is the final destination.")
985 uri = urllib.parse.urljoin(base, "deflate/failed-compression.asis")
994 # Re-run the test with out the exceptions
1003 uri = urllib.parse.urljoin(base, "duplicate-headers/multilink.asis")
1013 # Test Cache-Control: no-cache on requests
1016 uri, "GET", headers={"accept-encoding": "identity"}
1020 uri, "GET", headers={"accept-encoding": "identity"}
1028 headers={"accept-encoding": "identity", "Cache-Control": "no-cache"},
1034 # Test Pragma: no-cache on requests
1037 uri, "GET", headers={"accept-encoding": "identity"}
1041 uri, "GET", headers={"accept-encoding": "identity"}
1047 uri, "GET", headers={"accept-encoding": "identity", "Pragma": "no-cache"}
1053 # A no-store request means that the response should not be stored.
1057 uri, "GET", headers={"Cache-Control": "no-store"}
1063 uri, "GET", headers={"Cache-Control": "no-store"}
1069 # A no-store response means that the response should not be stored.
1070 uri = urllib.parse.urljoin(base, "no-store/no-store.asis")
1081 # Test that a no-store, no-cache clears the entry from the cache
1089 uri, "GET", headers={"Cache-Control": "no-store, no-cache"}
1092 uri, "GET", headers={"Cache-Control": "no-store, no-cache"}
1099 # URI that is cache invalidates that cache.
1113 uri = urllib.parse.urljoin(base, "conditional-updates/test.cgi")
1128 uri = urllib.parse.urljoin(base, "conditional-updates/test.cgi")
1143 uri = urllib.parse.urljoin(base, "conditional-updates/test.cgi")
1157 uri = urllib.parse.urljoin(base, "conditional-updates/test.cgi")
1166 uri, "PUT", body="foo", headers={"if-match": "fred"}
1236 uri = urllib.parse.urljoin(base, "basic-nested/")
1240 uri = urllib.parse.urljoin(base, "basic-nested/subdir")
1247 uri = urllib.parse.urljoin(base, "basic-nested/")
1251 uri = urllib.parse.urljoin(base, "basic-nested/subdir")
1257 uri = urllib.parse.urljoin(base, "basic-nested/")
1261 uri = urllib.parse.urljoin(base, "basic-nested/subdir")
1284 uri, "GET", headers={"cache-control": "no-cache"}
1286 info = httplib2._parse_www_authenticate(response, "authentication-info")
1289 uri, "GET", headers={"cache-control": "no-cache"}
1291 info2 = httplib2._parse_www_authenticate(response, "authentication-info")
1299 uri = urllib.parse.urljoin(base, "digest-expire/file.txt")
1302 uri, "GET", headers={"cache-control": "no-cache"}
1304 info = httplib2._parse_www_authenticate(response, "authentication-info")
1311 uri, "GET", headers={"cache-control": "no-cache"}
1315 info3 = httplib2._parse_www_authenticate(response, "authentication-info")
1322 for x in content.decode("utf-8").strip().split("\n")
1356 elif key == "cache":
1358 new_http.__dict__[key].cache, self.http.__dict__[key].cache
1387 self.cache = memcache.Client(["127.0.0.1:11211"], debug=0)
1388 # self.cache = memcache.Client(['10.0.0.4:11211'], debug=1)
1389 self.http = httplib2.Http(self.cache)
1390 self.cache.flush_all()
1403 # ------------------------------------------------------------------------
1408 # Test that we can parse the Cache-Control header
1411 {"no-cache": 1},
1412 httplib2._parse_cache_control({"cache-control": " no-cache"}),
1415 {"cache-control": " no-cache, max-age = 7200"}
1417 self.assertEqual(cc["no-cache"], 1)
1418 self.assertEqual(cc["max-age"], "7200")
1419 cc = httplib2._parse_cache_control({"cache-control": " , "})
1424 {"cache-control": "Max-age=3600;post-check=1800,pre-check=3600"}
1426 self.assertTrue("max-age" in cc)
1432 h = httplib2._normalize_headers({"Cache-Control": "no-cache", "Other": "Stuff"})
1433 self.assertTrue("cache-control" in h)
1444 # Test that no-cache makes our request TRANSPARENT
1445 response_headers = {"cache-control": "max-age=7200"}
1446 request_headers = {"cache-control": "no-cache"}
1453 # Test that no-cache makes our request TRANSPARENT
1454 response_headers = {"cache-control": "max-age=fred, min-fresh=barney"}
1462 # FRESH, but the no-cache over-rides that.
1467 "cache-control": "no-cache",
1475 # must-revalidate forces STALE
1478 httplib2._entry_disposition({}, {"cache-control": "must-revalidate"}),
1482 # must-revalidate forces STALE
1485 httplib2._entry_disposition({"cache-control": "must-revalidate"}, {}),
1491 "cache-control": "max-age=2",
1505 "cache-control": "max-age=0",
1550 request_headers = {"cache-control": "only-if-cached"}
1559 "cache-control": "max-age=2",
1561 request_headers = {"cache-control": "max-age=0"}
1572 request_headers = {"cache-control": "min-fresh=2"}
1583 request_headers = {"cache-control": "min-fresh=2"}
1596 "www-authenticate": 'Test realm="test realm" , foo=foo ,bar="bar", baz=baz,qux=qux'
1602 # tokens with non-alphanum
1604 {"www-authenticate": 'T*!%#st realm=to*!%#en, to*!%#en="quoted string"'}
1611 {"www-authenticate": 'Test realm="a \\"test\\" realm"'}
1622 res = httplib2._parse_www_authenticate({"www-authenticate": 'Basic realm="me"'})
1627 {"www-authenticate": 'Basic realm="me", algorithm="MD5"'}
1634 {"www-authenticate": 'Basic realm="me", algorithm=MD5'}
1642 {"www-authenticate": 'Basic realm="me",other="fred" '}
1650 {"www-authenticate": 'Basic REAlm="me" '}
1658 …"www-authenticate": 'Digest realm="testrealm@host.com", qop="auth,auth-int", nonce="dcd98b7102dd2f…
1663 self.assertEqual("auth,auth-int", digest["qop"])
1668 …"www-authenticate": 'Digest realm="testrealm@host.com", qop="auth,auth-int", nonce="dcd98b7102dd2f…
1673 self.assertEqual("auth,auth-int", digest["qop"])
1681 # originally sent in separate www-authenticate headers.
1684 …"www-authenticate": 'Digest realm="testrealm@host.com", qop="auth,auth-int", nonce="dcd98b7102dd2f…
1689 self.assertEqual("auth,auth-int", digest["qop"])
1697 # originally sent in separate www-authenticate headers.
1700 …"www-authenticate": 'Digest realm="testrealm@host.com", qop="auth,auth-int", nonce="dcd98b7102dd2f…
1705 self.assertEqual("auth,auth-int", digest["qop"])
1717 …"www-authenticate": 'Digest realm="test-real.m@host.com", qop \t=\t"\tauth,auth-int", nonce="(*)&^…
1721 self.assertEqual("test-real.m@host.com", digest["realm"])
1722 self.assertEqual("\tauth,auth-int", digest["qop"])
1728 …"www-authenticate": 'Digest realm="myrealm", nonce="Ygk86AsKBAA=3516200d37f9a3230352fde99977bd6d47…
1738 … "www-authenticate": 'OAuth "Facebook Platform" "invalid_token" "Invalid OAuth access token."'
1751 "www-authenticate": 'Digest realm="myrealm", '
1777 "www-authenticate": 'Digest realm="myrealm", '
1804 response["www-authenticate"] = (
1823 response["www-authenticate"] = (
1828 response["authentication-info"] = 'nextnonce="fred"'
1840 "d36e316282959a9ed4c89851497a717f", "2003-12-15T14:43:07Z", "taadtaadpstcsm"
1847 response = {"content-type": "application/atom+xml", "te": "deflate"}
1849 self.assertTrue("content-type" in end2end)
1855 "connection": "content-type",
1856 "content-type": "application/atom+xml",
1860 self.assertTrue("content-type" not in end2end)
1864 # Degenerate case of no headers
1870 response = {"connection": "content-type"}