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

Unified 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: s/DCHECK(false)/NOTREACHED()/ 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/url_request/url_request_context_builder.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_http_job.cc
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index 72fd2a8d19e1db77f50d2b82edd3c73ac088d801..589379a329c305c1c8cfa3aa64e30aa206b49ca5 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -66,6 +66,10 @@ bool IsMethodSafe(const std::string& method) {
method == "TRACE";
}
+// Logs whether the CookieStore used for this request matches the
+// ChannelIDService used when establishing the connection that this request is
+// sent over. This logging is only done for requests to accounts.google.com, and
+// only for requests where Channel ID was sent when establishing the connection.
void LogChannelIDAndCookieStores(const GURL& url,
const net::URLRequestContext* context,
const net::SSLInfo& ssl_info) {
@@ -74,16 +78,41 @@ void LogChannelIDAndCookieStores(const GURL& url,
// This enum is used for an UMA histogram - don't reuse or renumber entries.
enum {
// Value 0 was removed (CID_EPHEMERAL_COOKIE_EPHEMERAL)
+ // ChannelIDStore is ephemeral, but CookieStore is persistent.
CID_EPHEMERAL_COOKIE_PERSISTENT = 1,
+ // ChannelIDStore is persistent, but CookieStore is ephemeral.
CID_PERSISTENT_COOKIE_EPHEMERAL = 2,
// Value 3 was removed (CID_PERSISTENT_COOKIE_PERSISTENT)
+ // There is no CookieStore for this request.
NO_COOKIE_STORE = 4,
+ // There is no ChannelIDStore for this request. This should never happen,
+ // because we only log if Channel ID was sent.
NO_CHANNEL_ID_STORE = 5,
+ // A case where the CookieStore is persistent and the ChannelIDStore is
+ // ephemeral, but it has been identified as not being a problem.
KNOWN_MISMATCH = 6,
+ // Both stores are ephemeral, and the ChannelIDService used when
+ // establishing the connection is the same one that the CookieStore was
+ // created to be used with.
EPHEMERAL_MATCH = 7,
+ // Both stores are ephemeral, but a different CookieStore should have been
+ // used on this request.
EPHEMERAL_MISMATCH = 8,
+ // Both stores are persistent, and the ChannelIDService used when
+ // establishing the connection is the same one that the CookieStore was
+ // created to be used with.
PERSISTENT_MATCH = 9,
+ // Both stores are persistent, but a different CookieStore should have been
+ // used on this request.
PERSISTENT_MISMATCH = 10,
+ // Both stores are ephemeral, but it was never recorded in the CookieStore
+ // which ChannelIDService it was created for, so it is unknown whether the
+ // stores match.
+ EPHEMERAL_UNKNOWN = 11,
+ // Both stores are persistent, but it was never recorded in the CookieStore
+ // which ChannelIDService it was created for, so it is unknown whether the
+ // stores match.
+ PERSISTENT_UNKNOWN = 12,
EPHEMERALITY_MAX
} ephemerality;
const net::HttpNetworkSession::Params* params =
@@ -95,25 +124,31 @@ void LogChannelIDAndCookieStores(const GURL& url,
ephemerality = NO_COOKIE_STORE;
} else if (params->channel_id_service->GetChannelIDStore()->IsEphemeral()) {
if (cookie_store->IsEphemeral()) {
- if (context->channel_id_service() &&
- params->channel_id_service->GetUniqueID() ==
- context->channel_id_service()->GetUniqueID()) {
+ if (cookie_store->GetChannelIDServiceID() == -1) {
+ ephemerality = EPHEMERAL_UNKNOWN;
+ } else if (cookie_store->GetChannelIDServiceID() ==
+ params->channel_id_service->GetUniqueID()) {
ephemerality = EPHEMERAL_MATCH;
} else {
+ NOTREACHED();
ephemerality = EPHEMERAL_MISMATCH;
}
} else if (context->has_known_mismatched_cookie_store()) {
ephemerality = KNOWN_MISMATCH;
} else {
+ NOTREACHED();
ephemerality = CID_EPHEMERAL_COOKIE_PERSISTENT;
}
} else if (cookie_store->IsEphemeral()) {
+ NOTREACHED();
ephemerality = CID_PERSISTENT_COOKIE_EPHEMERAL;
- } else if (context->channel_id_service() &&
- params->channel_id_service->GetUniqueID() ==
- context->channel_id_service()->GetUniqueID()) {
+ } else if (cookie_store->GetChannelIDServiceID() == -1) {
+ ephemerality = PERSISTENT_UNKNOWN;
+ } else if (cookie_store->GetChannelIDServiceID() ==
+ params->channel_id_service->GetUniqueID()) {
ephemerality = PERSISTENT_MATCH;
} else {
+ NOTREACHED();
ephemerality = PERSISTENT_MISMATCH;
}
UMA_HISTOGRAM_ENUMERATION("Net.TokenBinding.StoreEphemerality", ephemerality,
« no previous file with comments | « 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