diff options
author | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 18:20:06 +0000 |
---|---|---|
committer | cbentzel@chromium.org <cbentzel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-13 18:20:06 +0000 |
commit | 65f3777483e77c1b2bd7de89ebf11ce9ba55c98d (patch) | |
tree | 9c5d052ebd85f592d9a3458f8e1e0daa084775fd /net/http/http_auth_controller.cc | |
parent | b9fc810b6adcc42e4d72cac03482c515696e2d96 (diff) | |
download | chromium_src-65f3777483e77c1b2bd7de89ebf11ce9ba55c98d.zip chromium_src-65f3777483e77c1b2bd7de89ebf11ce9ba55c98d.tar.gz chromium_src-65f3777483e77c1b2bd7de89ebf11ce9ba55c98d.tar.bz2 |
Histogram target for each HTTP Authentication Scheme.
For each HTTP authentication scheme, record whether it was started for a proxy, a secure proxy, a server, or a secure server.
Also, use a new scheme-based enumerated value as an index rather than the score.
BUG=None
TEST=trybots, look at about:histograms after authenticating to different resources.
Review URL: http://codereview.chromium.org/5563006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69018 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_auth_controller.cc')
-rw-r--r-- | net/http/http_auth_controller.cc | 79 |
1 files changed, 69 insertions, 10 deletions
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc index e4e2dd4..c324709a 100644 --- a/net/http/http_auth_controller.cc +++ b/net/http/http_auth_controller.cc @@ -52,10 +52,36 @@ std::string AuthChallengeLogMessage(HttpResponseHeaders* headers) { enum AuthEvent { AUTH_EVENT_START = 0, - AUTH_EVENT_REJECT = 1, - AUTH_EVENT_MAX = 2, + AUTH_EVENT_REJECT, + AUTH_EVENT_MAX, }; +enum AuthTarget { + AUTH_TARGET_PROXY = 0, + AUTH_TARGET_SECURE_PROXY, + AUTH_TARGET_SERVER, + AUTH_TARGET_SECURE_SERVER, + AUTH_TARGET_MAX, +}; + +AuthTarget DetermineAuthTarget(const HttpAuthHandler* handler) { + switch (handler->target()) { + case HttpAuth::AUTH_PROXY: + if (handler->origin().SchemeIsSecure()) + return AUTH_TARGET_SECURE_PROXY; + else + return AUTH_TARGET_PROXY; + case HttpAuth::AUTH_SERVER: + if (handler->origin().SchemeIsSecure()) + return AUTH_TARGET_SECURE_SERVER; + else + return AUTH_TARGET_SERVER; + default: + NOTREACHED(); + return AUTH_TARGET_MAX; + } +} + // Records the number of authentication events per authentication scheme. void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) { #if !defined(NDEBUG) @@ -68,8 +94,12 @@ void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) { DCHECK_EQ(first_thread, PlatformThread::CurrentId()); #endif - // This assumes that the schemes maintain a consistent score from - // 1 to 4 inclusive. The results map to: + HttpAuthHandler::AuthScheme auth_scheme = handler->auth_scheme(); + DCHECK(auth_scheme >= 0 && auth_scheme < HttpAuthHandler::AUTH_SCHEME_MAX); + + // Record start and rejection events for authentication. + // + // The results map to: // Basic Start: 0 // Basic Reject: 1 // Digest Start: 2 @@ -78,12 +108,41 @@ void HistogramAuthEvent(HttpAuthHandler* handler, AuthEvent auth_event) { // NTLM Reject: 5 // Negotiate Start: 6 // Negotiate Reject: 7 - static const int kScoreMin = 1; - static const int kScoreMax = 4; - static const int kBucketsMax = kScoreMax * AUTH_EVENT_MAX + 1; - DCHECK(handler->score() >= kScoreMin && handler->score() <= kScoreMax); - int bucket = (handler->score() - kScoreMin) * AUTH_EVENT_MAX + auth_event; - UMA_HISTOGRAM_ENUMERATION("Net.HttpAuthCount", bucket, kBucketsMax); + static const int kEventBucketsEnd = + HttpAuthHandler::AUTH_SCHEME_MAX * AUTH_EVENT_MAX; + int event_bucket = auth_scheme * AUTH_EVENT_MAX + auth_event; + DCHECK(event_bucket >= 0 && event_bucket < kEventBucketsEnd); + UMA_HISTOGRAM_ENUMERATION("Net.HttpAuthCount", event_bucket, + kEventBucketsEnd); + + // Record the target of the authentication. + // + // The results map to: + // Basic Proxy: 0 + // Basic Secure Proxy: 1 + // Basic Server: 2 + // Basic Secure Server: 3 + // Digest Proxy: 4 + // Digest Secure Proxy: 5 + // Digest Server: 6 + // Digest Secure Server: 7 + // NTLM Proxy: 8 + // NTLM Secure Proxy: 9 + // NTLM Server: 10 + // NTLM Secure Server: 11 + // Negotiate Proxy: 12 + // Negotiate Secure Proxy: 13 + // Negotiate Server: 14 + // Negotiate Secure Server: 15 + if (auth_event != AUTH_EVENT_START) + return; + static const int kTargetBucketsEnd = + HttpAuthHandler::AUTH_SCHEME_MAX * AUTH_TARGET_MAX; + AuthTarget auth_target = DetermineAuthTarget(handler); + int target_bucket = auth_scheme * AUTH_TARGET_MAX + auth_target; + DCHECK(target_bucket >= 0 && target_bucket < kTargetBucketsEnd); + UMA_HISTOGRAM_ENUMERATION("Net.HttpAuthTarget", target_bucket, + kTargetBucketsEnd); } } // namespace |