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

Side by Side Diff: net/http/http_auth_multi_round_parse.cc

Issue 1282363003: Convert remaining StringToLowerASCII to ToLowerASCII (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « net/http/http_auth_handler_factory.cc ('k') | net/http/http_log_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/base64.h" 5 #include "base/base64.h"
6 #include "base/strings/string_util.h" 6 #include "base/strings/string_util.h"
7 #include "net/http/http_auth_challenge_tokenizer.h" 7 #include "net/http/http_auth_challenge_tokenizer.h"
8 #include "net/http/http_auth_multi_round_parse.h" 8 #include "net/http/http_auth_multi_round_parse.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 namespace { 12 namespace {
13 13
14 // Check that the scheme in the challenge matches the expected scheme 14 // Check that the scheme in the challenge matches the expected scheme
15 bool SchemeIsValid(const std::string& scheme, 15 bool SchemeIsValid(const std::string& scheme,
16 HttpAuthChallengeTokenizer* challenge) { 16 HttpAuthChallengeTokenizer* challenge) {
17 // There is no guarantee that challenge->scheme() is valid ASCII, but 17 // There is no guarantee that challenge->scheme() is valid ASCII, but
18 // LowerCaseEqualsASCII will do the right thing even if it isn't. 18 // LowerCaseEqualsASCII will do the right thing even if it isn't.
19 return base::LowerCaseEqualsASCII(challenge->scheme(), 19 return base::LowerCaseEqualsASCII(challenge->scheme(),
20 base::StringToLowerASCII(scheme).c_str()); 20 base::ToLowerASCII(scheme));
21 } 21 }
22 22
23 } // namespace 23 } // namespace
24 24
25 HttpAuth::AuthorizationResult ParseFirstRoundChallenge( 25 HttpAuth::AuthorizationResult ParseFirstRoundChallenge(
26 const std::string& scheme, 26 const std::string& scheme,
27 HttpAuthChallengeTokenizer* challenge) { 27 HttpAuthChallengeTokenizer* challenge) {
28 // Verify the challenge's auth-scheme. 28 // Verify the challenge's auth-scheme.
29 if (!SchemeIsValid(scheme, challenge)) 29 if (!SchemeIsValid(scheme, challenge))
30 return HttpAuth::AUTHORIZATION_RESULT_INVALID; 30 return HttpAuth::AUTHORIZATION_RESULT_INVALID;
(...skipping 18 matching lines...) Expand all
49 if (encoded_token->empty()) 49 if (encoded_token->empty())
50 return HttpAuth::AUTHORIZATION_RESULT_REJECT; 50 return HttpAuth::AUTHORIZATION_RESULT_REJECT;
51 51
52 // Make sure the additional token is base64 encoded. 52 // Make sure the additional token is base64 encoded.
53 if (!base::Base64Decode(*encoded_token, decoded_token)) 53 if (!base::Base64Decode(*encoded_token, decoded_token))
54 return HttpAuth::AUTHORIZATION_RESULT_INVALID; 54 return HttpAuth::AUTHORIZATION_RESULT_INVALID;
55 return HttpAuth::AUTHORIZATION_RESULT_ACCEPT; 55 return HttpAuth::AUTHORIZATION_RESULT_ACCEPT;
56 } 56 }
57 57
58 } // namespace net 58 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_factory.cc ('k') | net/http/http_log_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698