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

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

Issue 1818603002: Keep track of ChannelIDService in CookieStore (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DCHECK Created 4 years, 9 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 "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 static const char kAvailDictionaryHeader[] = "Avail-Dictionary"; 58 static const char kAvailDictionaryHeader[] = "Avail-Dictionary";
59 59
60 namespace { 60 namespace {
61 61
62 // True if the request method is "safe" (per section 4.2.1 of RFC 7231). 62 // True if the request method is "safe" (per section 4.2.1 of RFC 7231).
63 bool IsMethodSafe(const std::string& method) { 63 bool IsMethodSafe(const std::string& method) {
64 return method == "GET" || method == "HEAD" || method == "OPTIONS" || 64 return method == "GET" || method == "HEAD" || method == "OPTIONS" ||
65 method == "TRACE"; 65 method == "TRACE";
66 } 66 }
67 67
68 void LogChannelIDAndCookieStores(const net::URLRequestContext* context, 68 void LogChannelIDAndCookieStores(const net::URLRequestContext* context,
mmenke 2016/03/28 17:54:00 This function really needs a comment., or the hist
nharper 2016/03/29 00:30:20 Done. Comments added for both.
69 const net::SSLInfo& ssl_info) { 69 const net::SSLInfo& ssl_info) {
70 if (!ssl_info.channel_id_sent) 70 if (!ssl_info.channel_id_sent)
71 return; 71 return;
72 // This enum is used for an UMA histogram - don't reuse or renumber entries. 72 // This enum is used for an UMA histogram - don't reuse or renumber entries.
73 enum { 73 enum {
74 // Value 0 was removed (CID_EPHEMERAL_COOKIE_EPHEMERAL) 74 // Value 0 was removed (CID_EPHEMERAL_COOKIE_EPHEMERAL)
75 CID_EPHEMERAL_COOKIE_PERSISTENT = 1, 75 CID_EPHEMERAL_COOKIE_PERSISTENT = 1,
76 CID_PERSISTENT_COOKIE_EPHEMERAL = 2, 76 CID_PERSISTENT_COOKIE_EPHEMERAL = 2,
77 // Value 3 was removed (CID_PERSISTENT_COOKIE_PERSISTENT) 77 // Value 3 was removed (CID_PERSISTENT_COOKIE_PERSISTENT)
78 NO_COOKIE_STORE = 4, 78 NO_COOKIE_STORE = 4,
79 NO_CHANNEL_ID_STORE = 5, 79 NO_CHANNEL_ID_STORE = 5,
80 KNOWN_MISMATCH = 6, 80 KNOWN_MISMATCH = 6,
81 EPHEMERAL_MATCH = 7, 81 EPHEMERAL_MATCH = 7,
82 EPHEMERAL_MISMATCH = 8, 82 EPHEMERAL_MISMATCH = 8,
83 PERSISTENT_MATCH = 9, 83 PERSISTENT_MATCH = 9,
84 PERSISTENT_MISMATCH = 10, 84 PERSISTENT_MISMATCH = 10,
85 EPHEMERAL_UNKNOWN = 11,
86 PERSISTENT_UNKNOWN = 12,
85 EPHEMERALITY_MAX 87 EPHEMERALITY_MAX
86 } ephemerality; 88 } ephemerality;
87 const net::HttpNetworkSession::Params* params = 89 const net::HttpNetworkSession::Params* params =
88 context->GetNetworkSessionParams(); 90 context->GetNetworkSessionParams();
89 net::CookieStore* cookie_store = context->cookie_store(); 91 net::CookieStore* cookie_store = context->cookie_store();
mmenke 2016/03/28 17:54:00 We allow NULL cookie stores.
nharper 2016/03/29 00:30:20 I check for a null cookie store a few lines down.
90 if (params == nullptr || params->channel_id_service == nullptr) { 92 if (params == nullptr || params->channel_id_service == nullptr) {
91 ephemerality = NO_CHANNEL_ID_STORE; 93 ephemerality = NO_CHANNEL_ID_STORE;
92 } else if (cookie_store == nullptr) { 94 } else if (cookie_store == nullptr) {
93 ephemerality = NO_COOKIE_STORE; 95 ephemerality = NO_COOKIE_STORE;
94 } else if (params->channel_id_service->GetChannelIDStore()->IsEphemeral()) { 96 } else if (params->channel_id_service->GetChannelIDStore()->IsEphemeral()) {
95 if (cookie_store->IsEphemeral()) { 97 if (cookie_store->IsEphemeral()) {
96 if (context->channel_id_service() && 98 if (cookie_store->GetChannelIDServiceID() == -1) {
97 params->channel_id_service->GetUniqueID() == 99 ephemerality = EPHEMERAL_UNKNOWN;
98 context->channel_id_service()->GetUniqueID()) { 100 } else if (cookie_store->GetChannelIDServiceID() ==
101 params->channel_id_service->GetUniqueID()) {
99 ephemerality = EPHEMERAL_MATCH; 102 ephemerality = EPHEMERAL_MATCH;
100 } else { 103 } else {
101 ephemerality = EPHEMERAL_MISMATCH; 104 ephemerality = EPHEMERAL_MISMATCH;
mmenke 2016/03/28 17:54:00 If this happens, it is a bug. Should we really be
nharper 2016/03/29 00:30:20 I don't see any reason why we can't DCHECK.
102 } 105 }
103 } else if (context->has_known_mismatched_cookie_store()) { 106 } else if (context->has_known_mismatched_cookie_store()) {
104 ephemerality = KNOWN_MISMATCH; 107 ephemerality = KNOWN_MISMATCH;
105 } else { 108 } else {
106 ephemerality = CID_EPHEMERAL_COOKIE_PERSISTENT; 109 ephemerality = CID_EPHEMERAL_COOKIE_PERSISTENT;
107 } 110 }
108 } else if (cookie_store->IsEphemeral()) { 111 } else if (cookie_store->IsEphemeral()) {
109 ephemerality = CID_PERSISTENT_COOKIE_EPHEMERAL; 112 ephemerality = CID_PERSISTENT_COOKIE_EPHEMERAL;
110 } else if (context->channel_id_service() && 113 } else if (cookie_store->GetChannelIDServiceID() == -1) {
111 params->channel_id_service->GetUniqueID() == 114 ephemerality = PERSISTENT_UNKNOWN;
112 context->channel_id_service()->GetUniqueID()) { 115 } else if (cookie_store->GetChannelIDServiceID() ==
116 params->channel_id_service->GetUniqueID()) {
113 ephemerality = PERSISTENT_MATCH; 117 ephemerality = PERSISTENT_MATCH;
114 } else { 118 } else {
115 ephemerality = PERSISTENT_MISMATCH; 119 ephemerality = PERSISTENT_MISMATCH;
116 } 120 }
117 UMA_HISTOGRAM_ENUMERATION("Net.TokenBinding.StoreEphemerality", ephemerality, 121 UMA_HISTOGRAM_ENUMERATION("Net.TokenBinding.StoreEphemerality", ephemerality,
118 EPHEMERALITY_MAX); 122 EPHEMERALITY_MAX);
119 } 123 }
120 124
121 } // namespace 125 } // namespace
122 126
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1601 return override_response_headers_.get() ? 1605 return override_response_headers_.get() ?
1602 override_response_headers_.get() : 1606 override_response_headers_.get() :
1603 transaction_->GetResponseInfo()->headers.get(); 1607 transaction_->GetResponseInfo()->headers.get();
1604 } 1608 }
1605 1609
1606 void URLRequestHttpJob::NotifyURLRequestDestroyed() { 1610 void URLRequestHttpJob::NotifyURLRequestDestroyed() {
1607 awaiting_callback_ = false; 1611 awaiting_callback_ = false;
1608 } 1612 }
1609 1613
1610 } // namespace net 1614 } // namespace net
OLDNEW
« net/cookies/cookie_store.h ('K') | « net/url_request/url_request_context_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698