Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(283)

Unified Diff: content/browser/download/download_job_factory.cc

Issue 2897743002: Limit parallel download to http GET requests. (Closed)
Patch Set: enum.xml. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/download/download_create_info.cc ('k') | content/browser/download/download_request_core.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_job_factory.cc
diff --git a/content/browser/download/download_job_factory.cc b/content/browser/download/download_job_factory.cc
index f1704709ba5c907fd8c9592b9693cf6cc1b96066..e68d8000525f9b3f8204d2116e8b8adaaae6779c 100644
--- a/content/browser/download/download_job_factory.cc
+++ b/content/browser/download/download_job_factory.cc
@@ -28,6 +28,7 @@ bool IsParallelizableDownload(const DownloadCreateInfo& create_info) {
// 4. Content-Length header.
// 5. Content-Length is no less than the minimum slice size configuration.
// 6. HTTP/1.1 protocol, not QUIC nor HTTP/1.0.
+ // 7. HTTP or HTTPS scheme with GET method in the initial request.
// Etag and last modified are stored into DownloadCreateInfo in
// DownloadRequestCore only if the response header complies to the strong
@@ -39,10 +40,12 @@ bool IsParallelizableDownload(const DownloadCreateInfo& create_info) {
create_info.total_bytes >= GetMinSliceSizeConfig();
bool satisfy_connection_type = create_info.connection_info ==
net::HttpResponseInfo::CONNECTION_INFO_HTTP1_1;
+ bool http_get_method =
+ create_info.method == "GET" && create_info.url().SchemeIsHTTPOrHTTPS();
bool is_parallelizable = has_strong_validator && create_info.accept_range &&
has_content_length && satisfy_min_file_size &&
- satisfy_connection_type;
+ satisfy_connection_type && http_get_method;
if (!IsParallelDownloadEnabled())
return is_parallelizable;
@@ -72,6 +75,10 @@ bool IsParallelizableDownload(const DownloadCreateInfo& create_info) {
RecordParallelDownloadCreationEvent(
ParallelDownloadCreationEvent::FALLBACK_REASON_CONNECTION_TYPE);
}
+ if (!http_get_method) {
+ RecordParallelDownloadCreationEvent(
+ ParallelDownloadCreationEvent::FALLBACK_REASON_HTTP_METHOD);
+ }
return is_parallelizable;
}
« no previous file with comments | « content/browser/download/download_create_info.cc ('k') | content/browser/download/download_request_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698