summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/base/load_flags.h3
-rw-r--r--net/http/http_cache.cc9
-rw-r--r--net/http/http_cache_unittest.cc1
-rw-r--r--net/url_request/url_request.h7
4 files changed, 20 insertions, 0 deletions
diff --git a/net/base/load_flags.h b/net/base/load_flags.h
index 7e3642a..7175713 100644
--- a/net/base/load_flags.h
+++ b/net/base/load_flags.h
@@ -37,6 +37,9 @@ enum {
// If present, upload progress messages should be provided to initiator.
LOAD_ENABLE_UPLOAD_PROGRESS = 1 << 6,
+ // If present, try to download the resource to a standalone file.
+ LOAD_ENABLE_DOWNLOAD_FILE = 1 << 7,
+
// If present, ignores certificate mismatches with the domain name.
// (The default behavior is to trigger an OnSSLCertificateError callback.)
LOAD_IGNORE_CERT_COMMON_NAME_INVALID = 1 << 8,
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 913dc00..e447031 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -606,6 +606,15 @@ void HttpCache::Transaction::SetRequest(const HttpRequestInfo* request) {
if (cache_->mode() == RECORD)
effective_load_flags_ |= LOAD_BYPASS_CACHE;
+ // If HttpCache has type MEDIA make sure LOAD_ENABLE_DOWNLOAD_FILE is set,
+ // otherwise make sure LOAD_ENABLE_DOWNLOAD_FILE is not set when HttpCache
+ // has type other than MEDIA.
+ if (cache_->type() == HttpCache::MEDIA) {
+ DCHECK(effective_load_flags_ & LOAD_ENABLE_DOWNLOAD_FILE);
+ } else {
+ DCHECK(!(effective_load_flags_ & LOAD_ENABLE_DOWNLOAD_FILE));
+ }
+
// Some headers imply load flags. The order here is significant.
//
// LOAD_DISABLE_CACHE : no cache read or write
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index 5db229b..7fc5e5c 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -1225,6 +1225,7 @@ TEST(HttpCache, SimpleGET_MediaCache) {
#endif
ScopedMockTransaction trans_info(kSimpleGET_Transaction);
+ trans_info.load_flags |= net::LOAD_ENABLE_DOWNLOAD_FILE;
TestCompletionCallback callback;
{
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index f4aee3a..fb25f45 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -307,6 +307,13 @@ class URLRequest {
return response_info_.ssl_info;
}
+ // Returns the platform specific file handle for the standalone file that
+ // contains response data. base::kInvalidPlatformFileValue is returned if
+ // such file is not available.
+ base::PlatformFile response_data_file() {
+ return response_info_.response_data_file;
+ }
+
// Returns the cookie values included in the response, if the request is one
// that can have cookies. Returns true if the request is a cookie-bearing
// type, false otherwise. This method may only be called once the