Chromium Code Reviews| 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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 } | 437 } |
| 438 | 438 |
| 439 void URLRequestHttpJob::StopCaching() { | 439 void URLRequestHttpJob::StopCaching() { |
| 440 if (transaction_.get()) | 440 if (transaction_.get()) |
| 441 transaction_->StopCaching(); | 441 transaction_->StopCaching(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 void URLRequestHttpJob::OnCanGetCookiesCompleted(int policy) { | 444 void URLRequestHttpJob::OnCanGetCookiesCompleted(int policy) { |
| 445 // If the request was destroyed, then there is no more work to do. | 445 // If the request was destroyed, then there is no more work to do. |
| 446 if (request_ && request_->delegate()) { | 446 if (request_ && request_->delegate()) { |
| 447 if (policy == net::ERR_ACCESS_DENIED) { | 447 if (policy == net::ERR_ACCESS_DENIED && |
|
darin (slow to review)
2010/11/30 18:24:11
style-nit: it seems like an outer if (request_->co
jochen (gone - plz use gerrit)
2010/12/03 16:02:32
Done.
| |
| 448 request_->context()->cookie_store()) { | |
| 448 request_->delegate()->OnGetCookies(request_, true); | 449 request_->delegate()->OnGetCookies(request_, true); |
| 449 } else if (policy == net::OK && request_->context()->cookie_store()) { | 450 } else if (policy == net::OK && request_->context()->cookie_store()) { |
| 450 request_->delegate()->OnGetCookies(request_, false); | 451 request_->delegate()->OnGetCookies(request_, false); |
| 451 net::CookieOptions options; | 452 net::CookieOptions options; |
| 452 options.set_include_httponly(); | 453 options.set_include_httponly(); |
| 453 std::string cookies = | 454 std::string cookies = |
| 454 request_->context()->cookie_store()->GetCookiesWithOptions( | 455 request_->context()->cookie_store()->GetCookiesWithOptions( |
| 455 request_->url(), options); | 456 request_->url(), options); |
| 456 if (!cookies.empty()) { | 457 if (!cookies.empty()) { |
| 457 request_info_.extra_headers.SetHeader( | 458 request_info_.extra_headers.SetHeader( |
| 458 net::HttpRequestHeaders::kCookie, cookies); | 459 net::HttpRequestHeaders::kCookie, cookies); |
| 459 } | 460 } |
| 460 } | 461 } |
| 461 // We may have been canceled within OnGetCookies. | 462 // We may have been canceled within OnGetCookies. |
| 462 if (GetStatus().is_success()) { | 463 if (GetStatus().is_success()) { |
| 463 StartTransaction(); | 464 StartTransaction(); |
| 464 } else { | 465 } else { |
| 465 NotifyCanceled(); | 466 NotifyCanceled(); |
| 466 } | 467 } |
| 467 } | 468 } |
| 468 Release(); // Balance AddRef taken in AddCookieHeaderAndStart | 469 Release(); // Balance AddRef taken in AddCookieHeaderAndStart |
| 469 } | 470 } |
| 470 | 471 |
| 471 void URLRequestHttpJob::OnCanSetCookieCompleted(int policy) { | 472 void URLRequestHttpJob::OnCanSetCookieCompleted(int policy) { |
| 472 // If the request was destroyed, then there is no more work to do. | 473 // If the request was destroyed, then there is no more work to do. |
| 473 if (request_ && request_->delegate()) { | 474 if (request_ && request_->delegate()) { |
| 474 if (policy == net::ERR_ACCESS_DENIED) { | 475 if (policy == net::ERR_ACCESS_DENIED) { |
|
darin (slow to review)
2010/11/30 18:24:11
why isn't OnSetCookie similarly disallowed when th
jochen (gone - plz use gerrit)
2010/12/03 16:02:32
Done.
| |
| 475 request_->delegate()->OnSetCookie( | 476 request_->delegate()->OnSetCookie( |
| 476 request_, | 477 request_, |
| 477 response_cookies_[response_cookies_save_index_], | 478 response_cookies_[response_cookies_save_index_], |
| 478 net::CookieOptions(), | 479 net::CookieOptions(), |
| 479 true); | 480 true); |
| 480 } else if ((policy == net::OK || policy == net::OK_FOR_SESSION_ONLY) && | 481 } else if ((policy == net::OK || policy == net::OK_FOR_SESSION_ONLY) && |
| 481 request_->context()->cookie_store()) { | 482 request_->context()->cookie_store()) { |
| 482 // OK to save the current response cookie now. | 483 // OK to save the current response cookie now. |
| 483 net::CookieOptions options; | 484 net::CookieOptions options; |
| 484 options.set_include_httponly(); | 485 options.set_include_httponly(); |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 HTTPSProberDelegate* delegate = | 935 HTTPSProberDelegate* delegate = |
| 935 new HTTPSProberDelegate(request_info_.url.host(), max_age, | 936 new HTTPSProberDelegate(request_info_.url.host(), max_age, |
| 936 include_subdomains, | 937 include_subdomains, |
| 937 ctx->transport_security_state()); | 938 ctx->transport_security_state()); |
| 938 if (!prober->ProbeHost(request_info_.url.host(), request()->context(), | 939 if (!prober->ProbeHost(request_info_.url.host(), request()->context(), |
| 939 delegate)) { | 940 delegate)) { |
| 940 delete delegate; | 941 delete delegate; |
| 941 } | 942 } |
| 942 } | 943 } |
| 943 } | 944 } |
| OLD | NEW |