OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // If the request was destroyed, then there is no more work to do. | 441 // If the request was destroyed, then there is no more work to do. |
442 if (request_ && request_->delegate()) { | 442 if (request_ && request_->delegate()) { |
443 if (policy == net::ERR_ACCESS_DENIED) { | 443 if (policy == net::ERR_ACCESS_DENIED) { |
444 request_->delegate()->OnGetCookiesBlocked(request_); | 444 request_->delegate()->OnGetCookiesBlocked(request_); |
445 } else if (policy == net::OK && request_->context()->cookie_store()) { | 445 } else if (policy == net::OK && request_->context()->cookie_store()) { |
446 net::CookieOptions options; | 446 net::CookieOptions options; |
447 options.set_include_httponly(); | 447 options.set_include_httponly(); |
448 std::string cookies = | 448 std::string cookies = |
449 request_->context()->cookie_store()->GetCookiesWithOptions( | 449 request_->context()->cookie_store()->GetCookiesWithOptions( |
450 request_->url(), options); | 450 request_->url(), options); |
451 if (request_->context()->InterceptRequestCookies(request_, cookies) && | 451 if (!cookies.empty()) { |
452 !cookies.empty()) { | |
453 request_info_.extra_headers.SetHeader( | 452 request_info_.extra_headers.SetHeader( |
454 net::HttpRequestHeaders::kCookie, cookies); | 453 net::HttpRequestHeaders::kCookie, cookies); |
455 } | 454 } |
456 } | 455 } |
457 // We may have been canceled within OnGetCookiesBlocked. | 456 // We may have been canceled within OnGetCookiesBlocked. |
458 if (GetStatus().is_success()) { | 457 if (GetStatus().is_success()) { |
459 StartTransaction(); | 458 StartTransaction(); |
460 } else { | 459 } else { |
461 NotifyCanceled(); | 460 NotifyCanceled(); |
462 } | 461 } |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 OnCanSetCookieCompleted(policy); | 777 OnCanSetCookieCompleted(policy); |
779 } | 778 } |
780 | 779 |
781 void URLRequestHttpJob::FetchResponseCookies( | 780 void URLRequestHttpJob::FetchResponseCookies( |
782 const net::HttpResponseInfo* response_info, | 781 const net::HttpResponseInfo* response_info, |
783 std::vector<std::string>* cookies) { | 782 std::vector<std::string>* cookies) { |
784 std::string name = "Set-Cookie"; | 783 std::string name = "Set-Cookie"; |
785 std::string value; | 784 std::string value; |
786 | 785 |
787 void* iter = NULL; | 786 void* iter = NULL; |
788 while (response_info->headers->EnumerateHeader(&iter, name, &value)) { | 787 while (response_info->headers->EnumerateHeader(&iter, name, &value)) |
789 if (request_->context()->InterceptResponseCookie(request_, value)) | 788 cookies->push_back(value); |
790 cookies->push_back(value); | |
791 } | |
792 } | 789 } |
793 | 790 |
794 class HTTPSProberDelegate : public net::HTTPSProberDelegate { | 791 class HTTPSProberDelegate : public net::HTTPSProberDelegate { |
795 public: | 792 public: |
796 HTTPSProberDelegate(const std::string& host, int max_age, | 793 HTTPSProberDelegate(const std::string& host, int max_age, |
797 bool include_subdomains, | 794 bool include_subdomains, |
798 net::TransportSecurityState* sts) | 795 net::TransportSecurityState* sts) |
799 : host_(host), | 796 : host_(host), |
800 max_age_(max_age), | 797 max_age_(max_age), |
801 include_subdomains_(include_subdomains), | 798 include_subdomains_(include_subdomains), |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
905 HTTPSProberDelegate* delegate = | 902 HTTPSProberDelegate* delegate = |
906 new HTTPSProberDelegate(request_info_.url.host(), max_age, | 903 new HTTPSProberDelegate(request_info_.url.host(), max_age, |
907 include_subdomains, | 904 include_subdomains, |
908 ctx->transport_security_state()); | 905 ctx->transport_security_state()); |
909 if (!prober->ProbeHost(request_info_.url.host(), request()->context(), | 906 if (!prober->ProbeHost(request_info_.url.host(), request()->context(), |
910 delegate)) { | 907 delegate)) { |
911 delete delegate; | 908 delete delegate; |
912 } | 909 } |
913 } | 910 } |
914 } | 911 } |
OLD | NEW |