Commit cdb1d1c7 authored by Eric Roman's avatar Eric Roman Committed by Commit Bot

Lower the timeout for fetching PAC scripts from 5 minutes to 30

seconds.

This applies to both fetches for WPAD, as well as explicit PAC URLs.

30 seconds should be comparable to Microsoft Edge's defaults (based on
some testing on Windows 10).

Bug: 251682
Change-Id: Id2cbe60d4d27946de043946a7aad8f926b40c9d9
Reviewed-on: https://chromium-review.googlesource.com/849116Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Commit-Queue: Eric Roman <eroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526871}
parent 814252e7
...@@ -35,7 +35,17 @@ const int kDefaultMaxResponseBytes = 1048576; // 1 megabyte ...@@ -35,7 +35,17 @@ const int kDefaultMaxResponseBytes = 1048576; // 1 megabyte
// The maximum duration (in milliseconds) allowed for fetching the PAC script. // The maximum duration (in milliseconds) allowed for fetching the PAC script.
// Responses exceeding this will fail with ERR_TIMED_OUT. // Responses exceeding this will fail with ERR_TIMED_OUT.
const int kDefaultMaxDurationMs = 300000; // 5 minutes //
// This timeout applies to both scripts fetched in the course of WPAD, as well
// as explicitly configured ones.
//
// If the default timeout is too high, auto-detect can stall for a long time,
// and if it is too low then slow loading scripts may be skipped.
//
// 30 seconds is a compromise between those competing goals. This value also
// appears to match Microsoft Edge (based on testing).
constexpr base::TimeDelta kDefaultMaxDuration =
base::TimeDelta::FromSeconds(30);
// Returns true if |mime_type| is one of the known PAC mime type. // Returns true if |mime_type| is one of the known PAC mime type.
bool IsPacMimeType(const std::string& mime_type) { bool IsPacMimeType(const std::string& mime_type) {
...@@ -82,7 +92,7 @@ ProxyScriptFetcherImpl::ProxyScriptFetcherImpl( ...@@ -82,7 +92,7 @@ ProxyScriptFetcherImpl::ProxyScriptFetcherImpl(
result_code_(OK), result_code_(OK),
result_text_(NULL), result_text_(NULL),
max_response_bytes_(kDefaultMaxResponseBytes), max_response_bytes_(kDefaultMaxResponseBytes),
max_duration_(base::TimeDelta::FromMilliseconds(kDefaultMaxDurationMs)), max_duration_(kDefaultMaxDuration),
weak_factory_(this) { weak_factory_(this) {
DCHECK(url_request_context); DCHECK(url_request_context);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment