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

Side by Side Diff: net/http/http_auth_challenge_tokenizer.h

Issue 1157333005: [net/http auth] Use strings to identify authentication schemes. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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_cache_unittest.cc ('k') | net/http/http_auth_challenge_tokenizer.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_ 5 #ifndef NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_
6 #define NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_ 6 #define NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
(...skipping 13 matching lines...) Expand all
24 public: 24 public:
25 HttpAuthChallengeTokenizer(std::string::const_iterator begin, 25 HttpAuthChallengeTokenizer(std::string::const_iterator begin,
26 std::string::const_iterator end); 26 std::string::const_iterator end);
27 ~HttpAuthChallengeTokenizer(); 27 ~HttpAuthChallengeTokenizer();
28 28
29 // Get the original text. 29 // Get the original text.
30 std::string challenge_text() const { 30 std::string challenge_text() const {
31 return std::string(begin_, end_); 31 return std::string(begin_, end_);
32 } 32 }
33 33
34 // Get the auth scheme of the challenge. 34 // Get the auth scheme of the challenge. Could potentially be invalid.
35 std::string::const_iterator scheme_begin() const { return scheme_begin_; } 35 std::string::const_iterator scheme_begin() const { return scheme_begin_; }
36 std::string::const_iterator scheme_end() const { return scheme_end_; } 36 std::string::const_iterator scheme_end() const { return scheme_end_; }
37 std::string scheme() const { 37
38 return std::string(scheme_begin_, scheme_end_); 38 // Return the normalized scheme for the challenge. Will be empty if the
39 } 39 // challenge was invalid. RFC 7235 requires a valid scheme to be a token. A
40 // normalized scheme is a lower case ASCII token.
41 std::string NormalizedScheme() const;
42
43 // Returns true if the scheme of the challenge is |scheme|. |scheme| is
44 // expected to be a valid scheme.
45 bool SchemeIs(const base::StringPiece& scheme) const;
40 46
41 std::string::const_iterator params_begin() const { return params_begin_; } 47 std::string::const_iterator params_begin() const { return params_begin_; }
42 std::string::const_iterator params_end() const { return params_end_; } 48 std::string::const_iterator params_end() const { return params_end_; }
43 HttpUtil::NameValuePairsIterator param_pairs() const; 49 HttpUtil::NameValuePairsIterator param_pairs() const;
44 std::string base64_param() const; 50 std::string base64_param() const;
45 51
46 private: 52 private:
47 void Init(std::string::const_iterator begin, 53 void Init(std::string::const_iterator begin,
48 std::string::const_iterator end); 54 std::string::const_iterator end);
49 55
50 std::string::const_iterator begin_; 56 std::string::const_iterator begin_;
51 std::string::const_iterator end_; 57 std::string::const_iterator end_;
52 58
53 std::string::const_iterator scheme_begin_; 59 std::string::const_iterator scheme_begin_;
54 std::string::const_iterator scheme_end_; 60 std::string::const_iterator scheme_end_;
55 61
56 std::string::const_iterator params_begin_; 62 std::string::const_iterator params_begin_;
57 std::string::const_iterator params_end_; 63 std::string::const_iterator params_end_;
58 }; 64 };
59 65
60 } // namespace net 66 } // namespace net
61 67
62 #endif // NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_ 68 #endif // NET_HTTP_HTTP_AUTH_CHALLENGE_TOKENIZER_
OLDNEW
« no previous file with comments | « net/http/http_auth_cache_unittest.cc ('k') | net/http/http_auth_challenge_tokenizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698