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

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

Issue 13609002: fix a problem that android cannot download files with basic authentication (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments Created 7 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 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/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 } 759 }
760 760
761 // Honor load flags that impact proxy caches. 761 // Honor load flags that impact proxy caches.
762 if (request_->load_flags & LOAD_BYPASS_CACHE) { 762 if (request_->load_flags & LOAD_BYPASS_CACHE) {
763 request_headers_.SetHeader(HttpRequestHeaders::kPragma, "no-cache"); 763 request_headers_.SetHeader(HttpRequestHeaders::kPragma, "no-cache");
764 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "no-cache"); 764 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "no-cache");
765 } else if (request_->load_flags & LOAD_VALIDATE_CACHE) { 765 } else if (request_->load_flags & LOAD_VALIDATE_CACHE) {
766 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "max-age=0"); 766 request_headers_.SetHeader(HttpRequestHeaders::kCacheControl, "max-age=0");
767 } 767 }
768 768
769 if (ShouldApplyProxyAuth() && HaveAuth(HttpAuth::AUTH_PROXY)) 769 bool has_auth = false;
770 if (ShouldApplyProxyAuth() && HaveAuth(HttpAuth::AUTH_PROXY)) {
770 auth_controllers_[HttpAuth::AUTH_PROXY]->AddAuthorizationHeader( 771 auth_controllers_[HttpAuth::AUTH_PROXY]->AddAuthorizationHeader(
771 &request_headers_); 772 &request_headers_);
772 if (ShouldApplyServerAuth() && HaveAuth(HttpAuth::AUTH_SERVER)) 773 has_auth = true;
asanka 2013/04/09 21:55:13 These are redundant with the check below. If the A
qinmin 2013/04/09 22:10:06 ah... ok, done On 2013/04/09 21:55:13, asanka wro
774 }
775 if (ShouldApplyServerAuth() && HaveAuth(HttpAuth::AUTH_SERVER)) {
773 auth_controllers_[HttpAuth::AUTH_SERVER]->AddAuthorizationHeader( 776 auth_controllers_[HttpAuth::AUTH_SERVER]->AddAuthorizationHeader(
774 &request_headers_); 777 &request_headers_);
778 has_auth = true;
779 }
775 780
776 request_headers_.MergeFrom(request_->extra_headers); 781 request_headers_.MergeFrom(request_->extra_headers);
782 has_auth = has_auth && (
783 request_headers_.HasHeader(HttpRequestHeaders::kAuthorization) ||
784 request_headers_.HasHeader(HttpRequestHeaders::kProxyAuthorization));
785 response_.did_use_http_auth = has_auth;
777 } 786 }
778 787
779 int HttpNetworkTransaction::DoInitRequestBody() { 788 int HttpNetworkTransaction::DoInitRequestBody() {
780 next_state_ = STATE_INIT_REQUEST_BODY_COMPLETE; 789 next_state_ = STATE_INIT_REQUEST_BODY_COMPLETE;
781 int rv = OK; 790 int rv = OK;
782 if (request_->upload_data_stream) 791 if (request_->upload_data_stream)
783 rv = request_->upload_data_stream->Init(io_callback_); 792 rv = request_->upload_data_stream->Init(io_callback_);
784 return rv; 793 return rv;
785 } 794 }
786 795
(...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1470 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1462 state); 1471 state);
1463 break; 1472 break;
1464 } 1473 }
1465 return description; 1474 return description;
1466 } 1475 }
1467 1476
1468 #undef STATE_CASE 1477 #undef STATE_CASE
1469 1478
1470 } // namespace net 1479 } // namespace net
OLDNEW
« no previous file with comments | « chrome/browser/android/intercept_download_resource_throttle.cc ('k') | net/http/http_response_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698