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

Side by Side Diff: net/url_request/url_request.cc

Issue 137493008: Retry HttpNetworkTransactions upon receipt of ERR_NETWORK_CHANGED during host resolution and … Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Flush task queue before restart Created 6 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/url_request/url_request.h" 5 #include "net/url_request/url_request.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 28 matching lines...) Expand all
39 39
40 using base::Time; 40 using base::Time;
41 using std::string; 41 using std::string;
42 42
43 namespace net { 43 namespace net {
44 44
45 namespace { 45 namespace {
46 46
47 // Max number of http redirects to follow. Same number as gecko. 47 // Max number of http redirects to follow. Same number as gecko.
48 const int kMaxRedirects = 20; 48 const int kMaxRedirects = 20;
49 // Default maximum number of times to retry a request after receiving
50 // ERR_NETWORK_CHANGED.
51 const int kDefaultMaxAutomaticRetriesOnNetworkChanges = 3;
mmenke 2014/02/13 20:20:17 Think it's a bit confusing to have max retries, in
49 52
50 // Discard headers which have meaning in POST (Content-Length, Content-Type, 53 // Discard headers which have meaning in POST (Content-Length, Content-Type,
51 // Origin). 54 // Origin).
52 void StripPostSpecificHeaders(HttpRequestHeaders* headers) { 55 void StripPostSpecificHeaders(HttpRequestHeaders* headers) {
53 // These are headers that may be attached to a POST. 56 // These are headers that may be attached to a POST.
54 headers->RemoveHeader(HttpRequestHeaders::kContentLength); 57 headers->RemoveHeader(HttpRequestHeaders::kContentLength);
55 headers->RemoveHeader(HttpRequestHeaders::kContentType); 58 headers->RemoveHeader(HttpRequestHeaders::kContentType);
56 headers->RemoveHeader(HttpRequestHeaders::kOrigin); 59 headers->RemoveHeader(HttpRequestHeaders::kOrigin);
57 } 60 }
58 61
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 is_pending_(false), 223 is_pending_(false),
221 is_redirecting_(false), 224 is_redirecting_(false),
222 redirect_limit_(kMaxRedirects), 225 redirect_limit_(kMaxRedirects),
223 priority_(priority), 226 priority_(priority),
224 identifier_(GenerateURLRequestIdentifier()), 227 identifier_(GenerateURLRequestIdentifier()),
225 calling_delegate_(false), 228 calling_delegate_(false),
226 use_blocked_by_as_load_param_(false), 229 use_blocked_by_as_load_param_(false),
227 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete, 230 before_request_callback_(base::Bind(&URLRequest::BeforeRequestComplete,
228 base::Unretained(this))), 231 base::Unretained(this))),
229 has_notified_completion_(false), 232 has_notified_completion_(false),
233 max_automatic_retries_on_network_changes_(
234 kDefaultMaxAutomaticRetriesOnNetworkChanges),
230 received_response_content_length_(0), 235 received_response_content_length_(0),
231 creation_time_(base::TimeTicks::Now()), 236 creation_time_(base::TimeTicks::Now()),
232 notified_before_network_start_(false) { 237 notified_before_network_start_(false) {
233 SIMPLE_STATS_COUNTER("URLRequestCount"); 238 SIMPLE_STATS_COUNTER("URLRequestCount");
234 239
235 // Sanity check out environment. 240 // Sanity check out environment.
236 DCHECK(base::MessageLoop::current()) 241 DCHECK(base::MessageLoop::current())
237 << "The current base::MessageLoop must exist"; 242 << "The current base::MessageLoop must exist";
238 243
239 CHECK(context); 244 CHECK(context);
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 new base::debug::StackTrace(NULL, 0); 1238 new base::debug::StackTrace(NULL, 0);
1234 *stack_trace_copy = stack_trace; 1239 *stack_trace_copy = stack_trace;
1235 stack_trace_.reset(stack_trace_copy); 1240 stack_trace_.reset(stack_trace_copy);
1236 } 1241 }
1237 1242
1238 const base::debug::StackTrace* URLRequest::stack_trace() const { 1243 const base::debug::StackTrace* URLRequest::stack_trace() const {
1239 return stack_trace_.get(); 1244 return stack_trace_.get();
1240 } 1245 }
1241 1246
1242 } // namespace net 1247 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698