summaryrefslogtreecommitdiffstats
path: root/net/http/http_cache.cc
Commit message (Collapse)AuthorAgeFilesLines
* Http Cache: Split HttpCache::Transaction to its own setrvargas@google.com2009-11-111-1582/+1
| | | | | | | | | | | | | of files. No real code change... I'm just moving code around. BUG=26729 TEST=none Review URL: http://codereview.chromium.org/387017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31693 0039d316-1c4b-4281-b951-d872f2087c98
* Clear disk cache when the cache is not initializedhclam@chromium.org2009-11-071-18/+20
| | | | | | | | | | | | | | BUG=24765 TEST=unit test, clear browsing data and the cache, media cache will be cleared even if a media object was not loaded. Since the disk cache backend in HttpCache is lazily initialized, clearing the cache before it receives the first transaction would have no effect. So initialize the disk cache explicitly when we clear the cache. Review URL: http://codereview.chromium.org/378015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31361 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Make sure that we handle byte range requests thatrvargas@google.com2009-11-031-3/+8
| | | | | | | | | | | | end up skipping the cache. BUG=26175 TEST=unittests Review URL: http://codereview.chromium.org/348053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30877 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Always preserve extra headers when dealing withrvargas@google.com2009-11-031-1/+3
| | | | | | | | | | | byte range requests. BUG=25755 TEST=unittests Review URL: http://codereview.chromium.org/339088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30773 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Allow multiple external validation headers.rvargas@google.com2009-11-021-55/+38
| | | | | | | | | | | | If the last pair of headers match the entry that we have we allow the server response to update the entry. BUG=23222 TEST=unittests Review URL: http://codereview.chromium.org/345019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30748 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Handle byte range requests when there is no cache entry.rvargas@google.com2009-10-271-0/+3
| | | | | | | | | | BUG=25873 TEST=unittest Review URL: http://codereview.chromium.org/330026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30165 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Make sure that we remove pending transactionsrvargas@google.com2009-10-261-3/+18
| | | | | | | | | | | when they belong to a doomed entry. BUG=25588 TEST=unittests Review URL: http://codereview.chromium.org/335015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30054 0039d316-1c4b-4281-b951-d872f2087c98
* Http Cache: Convert data writes from sysnchronous to asynchronous.rvargas@google.com2009-10-221-30/+76
| | | | | | | | | | BUG=21383 TEST=unit tests (original review for r25873: http://codereview.chromium.org/201065) Review URL: http://codereview.chromium.org/313013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29792 0039d316-1c4b-4281-b951-d872f2087c98
* Http Cache: Enable byte-range support by default.rvargas@google.com2009-10-161-4/+4
| | | | | | | | | | | | | | | The command line parameter to modify the behavior changes from --enable-byte-range-support to --disable-byte-range-support BUG=24989 TEST= current tests Review URL: http://codereview.chromium.org/267132 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29337 0039d316-1c4b-4281-b951-d872f2087c98
* HTTP Cache: Apply all freshness tests to Partial content entries.rvargas@google.com2009-10-161-0/+3
| | | | | | | | | BUG=24057 TEST=unittest Review URL: http://codereview.chromium.org/267122 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29301 0039d316-1c4b-4281-b951-d872f2087c98
* Convert the HTTP cache to use FilePath rather than wstring for thetony@chromium.org2009-10-151-6/+5
| | | | | | | | | | disk cache path. BUG=24672 Review URL: http://codereview.chromium.org/276048 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29213 0039d316-1c4b-4281-b951-d872f2087c98
* Final patch to convert disk cache to using FilePath instead oftony@chromium.org2009-10-151-2/+3
| | | | | | | | | | | wstring. After this patch, I'm able to start chrome in a user data dir with non-ascii characters on non-utf8 systems. BUG=24444 Review URL: http://codereview.chromium.org/267085 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29136 0039d316-1c4b-4281-b951-d872f2087c98
* Disk cache: Add a method to cancel pending sparse operations.rvargas@google.com2009-10-081-4/+36
| | | | | | | | | | | | | | | | | | | The sparse IO methods require exclusive use of the cache entry and they complain when that requirement is violated. When the user cancels a request and reissues another one to the same entry, we may be waiting for the previous operation to finish when we receive a new IO request, so we fail. This CL add a way for the HTTP cache to cancel IO operations and get a notification when the disk cache is able to operate on that entry again. BUG=23862 TEST=unittests Review URL: http://codereview.chromium.org/256090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28475 0039d316-1c4b-4281-b951-d872f2087c98
* Make HttpResponseInfo pickle'able, just moves some code from HttpCache to ↵michaeln@google.com2009-10-081-123/+3
| | | | | | | | | | | HttpResponseInfo. TEST=none BUG=none Review URL: http://codereview.chromium.org/269012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28363 0039d316-1c4b-4281-b951-d872f2087c98
* Initial CL for fixing some of the proxy auth issues.chron@chromium.org2009-10-061-0/+6
| | | | | | | | | | | | | | Auth_cache is contained in the http session. We need to share the http session with the parent profile request context in order to retain http authentication. Weirdly enough, Profile::GetDefaultRequestContext() is not the same as profile_->GetRequestContext(), It does NOT yet pop up a dialog if the user hasn't done so already. BUG=19581 TEST=Included. Review URL: http://codereview.chromium.org/241001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28086 0039d316-1c4b-4281-b951-d872f2087c98
* Handle range request on a truncated entryhclam@chromium.org2009-10-021-0/+2
| | | | | | | | | | This change will doom the truncated entry and creates a new sparse entry. TEST=unit tests Review URL: http://codereview.chromium.org/251067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27859 0039d316-1c4b-4281-b951-d872f2087c98
* Implement ScopedRunnableMethodFactory using WeakPtr.darin@chromium.org2009-09-251-17/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This required some changes to WeakPtr to support the addition of WeakPtrFactory::HasWeakPtrs(), which is used to implement ScopedRunnableMethodFactory::empty(). Now, the WeakReferenceOwner just holds a pointer to the Flag class, and the Flag holds a back-pointer that it can use to clear the WeakReferenceOwner's pointer when the Flag is destroyed. I use the null'ness of this back-pointer in place of the bool member that was previously used to indicate if the WeakReference is valid. It was also necessary to expose a HasOneRef method on RefCounted. I included one on RefCountedThreadSafe for completeness. Finally, I switched HttpCache over to using WeakPtr instead of RevocableStore so that I could delete RevocableStore. (I'm making this change to consolidate similar functionality.) R=abarth BUG=none TEST=none Review URL: http://codereview.chromium.org/235027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27287 0039d316-1c4b-4281-b951-d872f2087c98
* Replace some net::ERR_FAILED generic error codes with more specific codes.eroman@chromium.org2009-09-241-6/+8
| | | | | | | | | | The goal is to end up with more meaningful errors if a page fails to load. BUG=22623 Review URL: http://codereview.chromium.org/222009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27038 0039d316-1c4b-4281-b951-d872f2087c98
* Revert 25873.eroman@chromium.org2009-09-221-73/+31
| | | | | | | | | | | This appears to be responsible for a regression in downloading of files. BUG=http://crbug.com/406 TBR=darin Review URL: http://codereview.chromium.org/215035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26764 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Convert data writes from sysnchronous to asynchronous.rvargas@google.com2009-09-101-31/+73
| | | | | | | | | | BUG=21383 TEST=covered by current unit tests. Review URL: http://codereview.chromium.org/201065 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25873 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Don't delete sparse entries when wervargas@google.com2009-09-091-11/+18
| | | | | | | | | | | cancel the request. BUG=20930 TEST=unittests Review URL: http://codereview.chromium.org/193043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25736 0039d316-1c4b-4281-b951-d872f2087c98
* Add some trace-points to HttpCache for request profiling (cache entry ↵eroman@chromium.org2009-09-061-3/+15
| | | | | | | | | | | "open", "create", "waiting" and "read_info"). BUG=http://crbug.com/14478 TEST=HttpCache unittests. Review URL: http://codereview.chromium.org/201035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25583 0039d316-1c4b-4281-b951-d872f2087c98
* Bug fixing for range request support in HttpCachehclam@chromium.org2009-09-051-1/+0
| | | | | | | | | | | | | | | | | | | TEST=net_unittests --gtest_filter=HttpCache.GET_Previous206_NotModified Step to reproduce the failure: 1. Sparse cache has data for (0 - 9) 2. Make a non-range request for the resource 3. Server replies with 304 not modified 4. User would get 304 modified while 200 is expected The cause is that PartialData::ResponseHeadersOK requires a full specified range to accept the response when server replies with 304. This is not a valid assumption as the response of 304 can be caused by the cache submitting a range request for validation purpose. Review URL: http://codereview.chromium.org/198018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25569 0039d316-1c4b-4281-b951-d872f2087c98
* Http Cache: Add support for resuming downloading arvargas@google.com2009-09-041-29/+75
| | | | | | | | | | | | resource after the original request was interrupted. BUG=8995 TEST=unittests Review URL: http://codereview.chromium.org/197016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25551 0039d316-1c4b-4281-b951-d872f2087c98
* Update the request time of http cache entries on 304.eroman@chromium.org2009-09-041-0/+1
| | | | | | | | | BUG=http://crbug.com/20594 TEST=HttpCache.UpdatesRequestResponseTimeOn304 Review URL: http://codereview.chromium.org/199028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25541 0039d316-1c4b-4281-b951-d872f2087c98
* Update the response time of http cache entries on 304.eroman@chromium.org2009-09-041-0/+2
| | | | | | | | | BUG=http://crbug.com/20594 TEST=HttpCacheTest.UpdatesResponseTimeOn304 Review URL: http://codereview.chromium.org/197024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25484 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: reorder some functions. No code change.rvargas@google.com2009-09-011-77/+74
| | | | | | | | | | | | | I'm just making the order of the methods match the order of declaration again. BUG=nonde TEST=none Review URL: http://codereview.chromium.org/175042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25062 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Cleanup from tracking of bug 9952.rvargas@google.com2009-09-011-67/+12
| | | | | | | | | BUG=9952 TEST=none git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24992 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Bypass the cache for range requests that have validation headers.rvargas@google.com2009-08-281-0/+8
| | | | | | | | | BUG=20017 TEST=unittests Review URL: http://codereview.chromium.org/177016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24759 0039d316-1c4b-4281-b951-d872f2087c98
* Refactor function to unpack an Entry from its pickle to a HttpResponseInfo.mbelshe@google.com2009-08-251-12/+18
| | | | | | | | | | | This will be used for some dump_cache modifications which are coming. BUG=none TEST=none Review URL: http://codereview.chromium.org/174388 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24319 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Enable experimental support for byte range requests.rvargas@google.com2009-08-241-24/+21
| | | | | | | | | | | Requires --enable-byte-range-support BUG=12258 TEST=covered by unit tests. Review URL: http://codereview.chromium.org/173231 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24113 0039d316-1c4b-4281-b951-d872f2087c98
* Revert cl 24015rvargas@google.com2009-08-211-20/+24
| | | | | | | | | BUG=none TEST=none Review URL: http://codereview.chromium.org/174260 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24026 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Enable experimental support for byte range requests.rvargas@google.com2009-08-211-24/+20
| | | | | | | | | | | Requires --enable-byte-range-support BUG=12258 TEST=covered by unit tests. Review URL: http://codereview.chromium.org/173173 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24015 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Fix the code that handles 206s when revalidatingrvargas@google.com2009-08-201-18/+46
| | | | | | | | | | | a range from the cache. BUG=12258 TEST=unittests Review URL: http://codereview.chromium.org/174039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23881 0039d316-1c4b-4281-b951-d872f2087c98
* Add missing break statement.jhawkins@chromium.org2009-08-191-3/+5
| | | | | | | | | CID=5724 BUG=none TEST=none Review URL: http://codereview.chromium.org/173078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23766 0039d316-1c4b-4281-b951-d872f2087c98
* Pref-backed SSLConfigService for Linux.mattm@chromium.org2009-08-191-2/+4
| | | | | | | | | | Makes SSLConfigService into a ref-counted interface, and makes Profile own an SSLConfigServiceFactory which is used to create the SSLConfigService and pass it through the URLRequestContext on down to where it is actually used. R=eroman,wtc BUG=11507,19290 Review URL: http://codereview.chromium.org/165003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23757 0039d316-1c4b-4281-b951-d872f2087c98
* Make ClientSocketHandle::Init() typesafe.willchan@chromium.org2009-08-191-1/+1
| | | | | | | | | | | Introduce a REGISTER_SOCKET_PARAMS_FOR_POOL macro to register valid SocketParams for a ClientSocketPool subtype. Update HttpNetworkSession's ClientSocketPool to return the concrete TCPClientSocketPool instead of the parent interface. Renamed the member variable&accessor. Updated tests. BUG=http://crbug.com/13289 Review URL: http://codereview.chromium.org/173018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23743 0039d316-1c4b-4281-b951-d872f2087c98
* Http Cache: Additional byte-range support.rvargas@google.com2009-08-181-11/+57
| | | | | | | | | | | | | | | | | | | | * Now we can serve byte range requests from cached 200s. * When we receive 304 we make sure that we were expecting it. * A range request that doesn't fit the currently stored entry only deletes the entry if the server confirms that it has changed. * Make sure that LOAD_ONLY_FROM_CACHE causes cache misses for byte range requests. BUG=12258 TEST=unittests Review URL: http://codereview.chromium.org/165479 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23601 0039d316-1c4b-4281-b951-d872f2087c98
* LoadLog is used as an output parameter, reorder it to the last parameter.willchan@chromium.org2009-08-141-5/+5
| | | | | | Review URL: http://codereview.chromium.org/164531 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23419 0039d316-1c4b-4281-b951-d872f2087c98
* Add a "LoadLog" parameter to transactions, hostresolver, clientsocketpool ↵ericroman@google.com2009-08-121-6/+10
| | | | | | | | and proyxservice.This dependency comes from the parent URLRequest, and is used as a container for per-request profiling data.This change is strictly a no-op refactor -- the parameter is unused, and LoadLog does nothing.BUG=http://crbug.com/14478TEST=none -- just needs to compile and pass existing tests.DESIGN=<http://docs.google.com/Doc?id=dfhcnb2v_21gbtrcpr3&hl=en> Review URL: http://codereview.chromium.org/126303 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23127 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: Extend support for byte range requests.rvargas@google.com2009-08-121-21/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Now we handle regular requests (not byte range requests) that end up reading a cached entry that stores byte ranges. In this case we create a control object (partial_), but it's byte_range_ member is always invalid because the user is not requesting a range. * Given that we may find stored 206s that are not keeping sparse data, we detect that case and handle it. * Now we may end up reading 206 from disk (and the net) and having to change the returned status to be 200 (for regular requests). * We avoid performing re-validations for each piece of stored data. Instead, we consider the whole entry to be revalidated once, and read from the cache without asking the server (as far as we can). * When processing the received headers we now consider receiving 200 and 416 (instead of 206/304) and we handle inconsistencies in the range returned by the server (from what we expect). We also handle receiving 206 when we don't expect it. BUG=12258 TEST=unittests Review URL: http://codereview.chromium.org/164304 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23123 0039d316-1c4b-4281-b951-d872f2087c98
* Http Cache: Deactivate entries without having the key of thervargas@google.com2009-08-071-1/+16
| | | | | | | | | | | | | | | entry to delete. The disk cache may fail to provide the key for a given entry (if there is a disk error, for instance), so we fall back to enumerate the active entries to delete this one. BUG=9952 TEST=unittest Review URL: http://codereview.chromium.org/165089 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22701 0039d316-1c4b-4281-b951-d872f2087c98
* Update a comment.ericroman@google.com2009-08-041-1/+2
| | | | | | | | | | (This change was supposed to be part of <http://codereview.chromium.org/159463> but I got confused on which client owned the CL, and ended up updating the wrong one!). TBR=darin Review URL: http://codereview.chromium.org/160567 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22432 0039d316-1c4b-4281-b951-d872f2087c98
* Support user-constructed conditional requests to HttpCache updating the cache.ericroman@google.com2009-08-031-20/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are requests where conditionalization is specified through |extra_headers| rather than through a load flag (LOAD_VALIDATE_CACHE). The previous behavior was that such requests would disable caching. So any more up-to-date response discovered by an "if-modifed-since" request was never written back to the cache. BUG=http://crbug.com/16199 TEST=HttpCache unit tes Overview for how these requests are dealt with: (1) When starting the request, check for an "if-modified-since" or "if-none-match" request header. If one is found: * let it be called |external_validation_header| * continue to (2). (2) Parse |external_validation_header| to obtain either an |etag| or a |last_modified_date|. (3) Read the HTTP cache entry for URL. Call the result |entry|. (4) Now that we have read the cache entry, check if |external_validation_header| defines a validation request for |entry|. We cannot assume that |external_validation_header| makes sense in the context of |entry|, since the headers are free-form text originating from WebCore, and could be unrelated to the cache entry. If any of the following are true, then |external_validation_header| does NOT define a validation request for |entry|: * |entry| is undefined (was not found in step (3)). * |entry| has no "etag" or "last-modified" headers. * |entry| has a "last-modified" header, but it is not equal to |external_validation_header|'s |last_modified_date|. * |entry| has an "etag" header, but it does not match |external_validation_header|'s |etag|. Let |is_validation_request| be the result of this test. If |is_validation_request|, then we can safely use the response from the subsequent network response to update |entry|. If |!is_validation_request|, then we disable caching before proceeding on to the network request. NOTE: we turned off writing back to cache in this case, since a 304 response received from the server doesn't tell us anything about our cache entry. And moreover trying to handle a non-304 response would be awkward to deal with since the transaction would have to enter a "maybe will write to cache" state. (5) Start the network transaction. (6) On completion of the network transaction: if we are doing an internal OR an external validation request: if |http_code == 304| update |entry|'s response headers with the new response headers. if it was externally conditionalized: return the received response (304) to the user else if it was internally conditionalized: return the cached response (200) to the user Review URL: http://codereview.chromium.org/159463 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22328 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: dump the transaction and active entry keyrvargas@google.com2009-07-291-2/+11
| | | | | | | | | | | to check that they are not the same. BUG=9952 TEST=none Review URL: http://codereview.chromium.org/159594 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21974 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: revert dumping the transaction key.rvargas@google.com2009-07-291-9/+2
| | | | | | | | | | TBR=darin TEST=none BUG=9952 Review URL: http://codereview.chromium.org/159591 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21967 0039d316-1c4b-4281-b951-d872f2087c98
* Http cache: dump the transaction and active entry keyrvargas@google.com2009-07-291-2/+9
| | | | | | | | | | | | to check that they are not the same. BUG=9952 TEST=none Review URL: http://codereview.chromium.org/159563 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21964 0039d316-1c4b-4281-b951-d872f2087c98
* Strip embedded "#" in URLs when constructing HTTP cache key.ericroman@google.com2009-07-231-3/+2
| | | | | | | | | BUG=http://crbug.com/17493 TEST=HttpCache.UrlContainingHash Review URL: http://codereview.chromium.org/155972 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21408 0039d316-1c4b-4281-b951-d872f2087c98
* Add more code to debug a crash inside HttpCache::DeactivateEntryrvargas@google.com2009-07-061-5/+33
| | | | | | | | | BUG=9952 TEST=none Review URL: http://codereview.chromium.org/155018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19981 0039d316-1c4b-4281-b951-d872f2087c98
* Fix a browser crash during cache validation.rvargas@google.com2009-06-301-0/+10
| | | | | | | | | | | | | | | It is possible for a crazy server to return 206 even though we are not making a range request. In that case, we should not allow the stored response to go through the logic for range support (which right now is disabled). We've always stored those 206s though. BUG=15617 TEST=unittest Review URL: http://codereview.chromium.org/150090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19621 0039d316-1c4b-4281-b951-d872f2087c98