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

Side by Side Diff: chrome/common/net/gaia/gaia_oauth_client.cc

Issue 6966038: Anti-DDoS enhancements: Log to net log, UMA stats, improved policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/passive_log_collector.cc ('k') | chrome/common/net/url_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/net/gaia/gaia_oauth_client.h" 5 #include "chrome/common/net/gaia/gaia_oauth_client.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/net/http_return.h" 10 #include "chrome/common/net/http_return.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 void GaiaOAuthClient::Core::OnURLFetchComplete( 116 void GaiaOAuthClient::Core::OnURLFetchComplete(
117 const URLFetcher* source, 117 const URLFetcher* source,
118 const GURL& url, 118 const GURL& url,
119 const net::URLRequestStatus& status, 119 const net::URLRequestStatus& status,
120 int response_code, 120 int response_code,
121 const net::ResponseCookies& cookies, 121 const net::ResponseCookies& cookies,
122 const std::string& data) { 122 const std::string& data) {
123 bool should_retry = false; 123 bool should_retry = false;
124 HandleResponse(source, url, status, response_code, data, &should_retry); 124 HandleResponse(source, url, status, response_code, data, &should_retry);
125 if (should_retry) { 125 if (should_retry) {
126 // If the response code is greater than or equal to 500, then the back-off 126 // Explicitly call ReceivedContentWasMalformed() to ensure the current
127 // period has been increased at the network level; otherwise, explicitly 127 // request gets counted as a failure for calculation of the back-off
128 // call ReceivedContentWasMalformed() to count the current request as a 128 // period. If it was already a failure by status code, this call will
129 // failure and increase the back-off period. 129 // be ignored.
130 if (response_code < 500) 130 request_->ReceivedContentWasMalformed();
131 request_->ReceivedContentWasMalformed();
132 num_retries_++; 131 num_retries_++;
133 request_->Start(); 132 request_->Start();
134 } else { 133 } else {
135 request_.reset(); 134 request_.reset();
136 } 135 }
137 } 136 }
138 137
139 void GaiaOAuthClient::Core::HandleResponse( 138 void GaiaOAuthClient::Core::HandleResponse(
140 const URLFetcher* source, 139 const URLFetcher* source,
141 const GURL& url, 140 const GURL& url,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 const std::string& refresh_token, 208 const std::string& refresh_token,
210 int max_retries, 209 int max_retries,
211 Delegate* delegate) { 210 Delegate* delegate) {
212 return core_->RefreshToken(oauth_client_info, 211 return core_->RefreshToken(oauth_client_info,
213 refresh_token, 212 refresh_token,
214 max_retries, 213 max_retries,
215 delegate); 214 delegate);
216 } 215 }
217 216
218 } // namespace gaia 217 } // namespace gaia
OLDNEW
« no previous file with comments | « chrome/browser/net/passive_log_collector.cc ('k') | chrome/common/net/url_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698