OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef NET_HTTP_HTTP_AUTH_H_ |
6 #define NET_HTTP_HTTP_AUTH_H_ | 6 #define NET_HTTP_HTTP_AUTH_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // according to RFC 2617 Sec 1.2: | 171 // according to RFC 2617 Sec 1.2: |
172 // challenge = auth-scheme 1*SP 1#auth-param | 172 // challenge = auth-scheme 1*SP 1#auth-param |
173 // | 173 // |
174 // Depending on the challenge scheme, it may be appropriate to interpret the | 174 // Depending on the challenge scheme, it may be appropriate to interpret the |
175 // parameters as either a base-64 encoded string or a comma-delimited list | 175 // parameters as either a base-64 encoded string or a comma-delimited list |
176 // of name-value pairs. param_pairs() and base64_param() methods are provided | 176 // of name-value pairs. param_pairs() and base64_param() methods are provided |
177 // to support either usage. | 177 // to support either usage. |
178 class NET_EXPORT_PRIVATE ChallengeTokenizer { | 178 class NET_EXPORT_PRIVATE ChallengeTokenizer { |
179 public: | 179 public: |
180 ChallengeTokenizer(std::string::const_iterator begin, | 180 ChallengeTokenizer(std::string::const_iterator begin, |
181 std::string::const_iterator end) | 181 std::string::const_iterator end); |
182 : begin_(begin), | |
183 end_(end), | |
184 scheme_begin_(begin), | |
185 scheme_end_(begin), | |
186 params_begin_(end), | |
187 params_end_(end) { | |
188 Init(begin, end); | |
189 } | |
190 | 182 |
191 // Get the original text. | 183 // Get the original text. |
192 std::string challenge_text() const { | 184 std::string challenge_text() const { |
193 return std::string(begin_, end_); | 185 return std::string(begin_, end_); |
194 } | 186 } |
195 | 187 |
196 // Get the auth scheme of the challenge. | 188 // Get the auth scheme of the challenge. |
197 std::string::const_iterator scheme_begin() const { return scheme_begin_; } | 189 std::string::const_iterator scheme_begin() const { return scheme_begin_; } |
198 std::string::const_iterator scheme_end() const { return scheme_end_; } | 190 std::string::const_iterator scheme_end() const { return scheme_end_; } |
199 std::string scheme() const { | 191 std::string scheme() const { |
(...skipping 14 matching lines...) Expand all Loading... |
214 std::string::const_iterator scheme_end_; | 206 std::string::const_iterator scheme_end_; |
215 | 207 |
216 std::string::const_iterator params_begin_; | 208 std::string::const_iterator params_begin_; |
217 std::string::const_iterator params_end_; | 209 std::string::const_iterator params_end_; |
218 }; | 210 }; |
219 }; | 211 }; |
220 | 212 |
221 } // namespace net | 213 } // namespace net |
222 | 214 |
223 #endif // NET_HTTP_HTTP_AUTH_H_ | 215 #endif // NET_HTTP_HTTP_AUTH_H_ |
OLD | NEW |