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

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

Issue 2633663003: Implements strict secure cookies as the default behavior in //net (Closed)
Patch Set: Rebase on ToT Created 3 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
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_http_job.h" 5 #include "net/url_request/url_request_http_job.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base_switches.h" 9 #include "base/base_switches.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 base::Time response_date; 748 base::Time response_date;
749 if (!GetResponseHeaders()->GetDateValue(&response_date)) 749 if (!GetResponseHeaders()->GetDateValue(&response_date))
750 response_date = base::Time(); 750 response_date = base::Time();
751 751
752 if (!(request_info_.load_flags & LOAD_DO_NOT_SAVE_COOKIES) && 752 if (!(request_info_.load_flags & LOAD_DO_NOT_SAVE_COOKIES) &&
753 request_->context()->cookie_store()) { 753 request_->context()->cookie_store()) {
754 CookieOptions options; 754 CookieOptions options;
755 options.set_include_httponly(); 755 options.set_include_httponly();
756 options.set_server_time(response_date); 756 options.set_server_time(response_date);
757 757
758 if (network_delegate() &&
759 network_delegate()->AreStrictSecureCookiesEnabled()) {
760 options.set_enforce_strict_secure();
761 }
762
763 // Set all cookies, without waiting for them to be set. Any subsequent read 758 // Set all cookies, without waiting for them to be set. Any subsequent read
764 // will see the combined result of all cookie operation. 759 // will see the combined result of all cookie operation.
765 const base::StringPiece name("Set-Cookie"); 760 const base::StringPiece name("Set-Cookie");
766 std::string cookie; 761 std::string cookie;
767 size_t iter = 0; 762 size_t iter = 0;
768 HttpResponseHeaders* headers = GetResponseHeaders(); 763 HttpResponseHeaders* headers = GetResponseHeaders();
769 while (headers->EnumerateHeader(&iter, name, &cookie)) { 764 while (headers->EnumerateHeader(&iter, name, &cookie)) {
770 if (cookie.empty() || !CanSetCookie(cookie, &options)) 765 if (cookie.empty() || !CanSetCookie(cookie, &options))
771 continue; 766 continue;
772 request_->context()->cookie_store()->SetCookieWithOptionsAsync( 767 request_->context()->cookie_store()->SetCookieWithOptionsAsync(
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 awaiting_callback_ = false; 1551 awaiting_callback_ = false;
1557 1552
1558 // Notify NetworkQualityEstimator. 1553 // Notify NetworkQualityEstimator.
1559 NetworkQualityEstimator* network_quality_estimator = 1554 NetworkQualityEstimator* network_quality_estimator =
1560 request()->context()->network_quality_estimator(); 1555 request()->context()->network_quality_estimator();
1561 if (network_quality_estimator) 1556 if (network_quality_estimator)
1562 network_quality_estimator->NotifyURLRequestDestroyed(*request()); 1557 network_quality_estimator->NotifyURLRequestDestroyed(*request());
1563 } 1558 }
1564 1559
1565 } // namespace net 1560 } // namespace net
OLDNEW
« no previous file with comments | « net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc ('k') | net/url_request/url_request_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698