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

Unified Diff: net/url_request/url_request_throttler_entry.cc

Issue 10190002: Remove X-Retry-After support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
Index: net/url_request/url_request_throttler_entry.cc
diff --git a/net/url_request/url_request_throttler_entry.cc b/net/url_request/url_request_throttler_entry.cc
index 3ef2db0a1d685348099fc5c8f831f16624568feb..3154f9c04d58e812c578a3483f4f6c79b2de58d8 100644
--- a/net/url_request/url_request_throttler_entry.cc
+++ b/net/url_request/url_request_throttler_entry.cc
@@ -44,7 +44,6 @@ const double URLRequestThrottlerEntry::kDefaultMultiplyFactor = 1.4;
const double URLRequestThrottlerEntry::kDefaultJitterFactor = 0.4;
const int URLRequestThrottlerEntry::kDefaultMaximumBackoffMs = 15 * 60 * 1000;
const int URLRequestThrottlerEntry::kDefaultEntryLifetimeMs = 2 * 60 * 1000;
-const char URLRequestThrottlerEntry::kRetryHeaderName[] = "X-Retry-After";
const char URLRequestThrottlerEntry::kExponentialThrottlingHeader[] =
"X-Chrome-Exponential-Throttling";
const char URLRequestThrottlerEntry::kExponentialThrottlingDisableValue[] =
@@ -75,27 +74,6 @@ class RejectedRequestParameters : public NetLog::EventParameters {
int release_after_ms_;
};
-// NetLog parameters when a response contains an X-Retry-After header.
-class RetryAfterParameters : public NetLog::EventParameters {
- public:
- RetryAfterParameters(const std::string& url_id,
- int retry_after_ms)
- : url_id_(url_id),
- retry_after_ms_(retry_after_ms) {
- }
-
- virtual Value* ToValue() const {
- DictionaryValue* dict = new DictionaryValue();
- dict->SetString("url", url_id_);
- dict->SetInteger("retry_after_ms", retry_after_ms_);
- return dict;
- }
-
- private:
- std::string url_id_;
- int retry_after_ms_;
-};
-
URLRequestThrottlerEntry::URLRequestThrottlerEntry(
URLRequestThrottlerManager* manager,
const std::string& url_id)
@@ -264,10 +242,6 @@ void URLRequestThrottlerEntry::UpdateWithResponse(
} else {
GetBackoffEntry()->InformOfRequest(true);
- std::string retry_header = response->GetNormalizedValue(kRetryHeaderName);
- if (!retry_header.empty())
- HandleCustomRetryAfter(retry_header);
-
std::string throttling_header = response->GetNormalizedValue(
kExponentialThrottlingHeader);
if (!throttling_header.empty())
@@ -337,36 +311,6 @@ base::TimeTicks URLRequestThrottlerEntry::ImplGetTimeNow() const {
return base::TimeTicks::Now();
}
-void URLRequestThrottlerEntry::HandleCustomRetryAfter(
- const std::string& header_value) {
- // Input parameter is the number of seconds to wait in a floating point value.
- double time_in_sec = 0;
- bool conversion_is_ok = base::StringToDouble(header_value, &time_in_sec);
-
- // Conversion of custom retry-after header value failed.
- if (!conversion_is_ok)
- return;
-
- // We must use an int value later so we transform this in milliseconds.
- int64 value_ms = static_cast<int64>(0.5 + time_in_sec * 1000);
-
- // We do not check for an upper bound; the server can set any Retry-After it
- // desires. Recovery from error would involve restarting the browser.
- if (value_ms < 0)
- return;
-
- net_log_.AddEvent(
- NetLog::TYPE_THROTTLING_GOT_CUSTOM_RETRY_AFTER,
- make_scoped_refptr(new RetryAfterParameters(url_id_, value_ms)));
-
- base::TimeDelta value = base::TimeDelta::FromMilliseconds(value_ms);
- GetBackoffEntry()->SetCustomReleaseTime(ImplGetTimeNow() + value);
-
- UMA_HISTOGRAM_CUSTOM_TIMES(
- "Throttling.CustomRetryAfterMs", value,
- base::TimeDelta::FromSeconds(1), base::TimeDelta::FromHours(12), 50);
-}
-
void URLRequestThrottlerEntry::HandleThrottlingHeader(
const std::string& header_value,
const std::string& host) {
« no previous file with comments | « net/url_request/url_request_throttler_entry.h ('k') | net/url_request/url_request_throttler_test_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698