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

Side by Side Diff: net/http/http_network_transaction.cc

Issue 389007: After draining the body of a 401/407 response, verify that... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Improve comments Created 11 years, 1 month 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 | « no previous file | net/http/http_network_transaction_unittest.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include "base/scoped_ptr.h" 7 #include "base/scoped_ptr.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/field_trial.h" 9 #include "base/field_trial.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 keep_alive = true; 270 keep_alive = true;
271 } 271 }
272 272
273 // We don't need to drain the response body, so we act as if we had drained 273 // We don't need to drain the response body, so we act as if we had drained
274 // the response body. 274 // the response body.
275 DidDrainBodyForAuthRestart(keep_alive); 275 DidDrainBodyForAuthRestart(keep_alive);
276 } 276 }
277 277
278 void HttpNetworkTransaction::DidDrainBodyForAuthRestart(bool keep_alive) { 278 void HttpNetworkTransaction::DidDrainBodyForAuthRestart(bool keep_alive) {
279 if (keep_alive) { 279 if (keep_alive && connection_.socket()->IsConnectedAndIdle()) {
280 // We should call connection_.set_idle_time(), but this doesn't occur
281 // often enough to be worth the trouble.
280 next_state_ = STATE_SEND_REQUEST; 282 next_state_ = STATE_SEND_REQUEST;
283 connection_.set_is_reused(true);
281 reused_socket_ = true; 284 reused_socket_ = true;
282 } else { 285 } else {
283 next_state_ = STATE_INIT_CONNECTION; 286 next_state_ = STATE_INIT_CONNECTION;
284 connection_.socket()->Disconnect(); 287 connection_.socket()->Disconnect();
285 connection_.Reset(); 288 connection_.Reset();
286 } 289 }
287 290
288 // Reset the other member variables. 291 // Reset the other member variables.
289 ResetStateForRestart(); 292 ResetStateForRestart();
290 } 293 }
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1662 AuthChallengeInfo* auth_info = new AuthChallengeInfo; 1665 AuthChallengeInfo* auth_info = new AuthChallengeInfo;
1663 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY; 1666 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY;
1664 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin)); 1667 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin));
1665 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme()); 1668 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme());
1666 // TODO(eroman): decode realm according to RFC 2047. 1669 // TODO(eroman): decode realm according to RFC 2047.
1667 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm()); 1670 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm());
1668 http_stream_->GetResponseInfo()->auth_challenge = auth_info; 1671 http_stream_->GetResponseInfo()->auth_challenge = auth_info;
1669 } 1672 }
1670 1673
1671 } // namespace net 1674 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698