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 #include "net/http/http_auth.h" | 5 #include "net/http/http_auth.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 authorization_result = handler->HandleAnotherChallenge(&props); | 79 authorization_result = handler->HandleAnotherChallenge(&props); |
80 if (authorization_result != HttpAuth::AUTHORIZATION_RESULT_INVALID) { | 80 if (authorization_result != HttpAuth::AUTHORIZATION_RESULT_INVALID) { |
81 *challenge_used = challenge; | 81 *challenge_used = challenge; |
82 return authorization_result; | 82 return authorization_result; |
83 } | 83 } |
84 } | 84 } |
85 // Finding no matches is equivalent to rejection. | 85 // Finding no matches is equivalent to rejection. |
86 return HttpAuth::AUTHORIZATION_RESULT_REJECT; | 86 return HttpAuth::AUTHORIZATION_RESULT_REJECT; |
87 } | 87 } |
88 | 88 |
| 89 HttpAuth::ChallengeTokenizer::ChallengeTokenizer( |
| 90 std::string::const_iterator begin, |
| 91 std::string::const_iterator end) |
| 92 : begin_(begin), |
| 93 end_(end), |
| 94 scheme_begin_(begin), |
| 95 scheme_end_(begin), |
| 96 params_begin_(end), |
| 97 params_end_(end) { |
| 98 Init(begin, end); |
| 99 } |
| 100 |
89 HttpUtil::NameValuePairsIterator HttpAuth::ChallengeTokenizer::param_pairs() | 101 HttpUtil::NameValuePairsIterator HttpAuth::ChallengeTokenizer::param_pairs() |
90 const { | 102 const { |
91 return HttpUtil::NameValuePairsIterator(params_begin_, params_end_, ','); | 103 return HttpUtil::NameValuePairsIterator(params_begin_, params_end_, ','); |
92 } | 104 } |
93 | 105 |
94 std::string HttpAuth::ChallengeTokenizer::base64_param() const { | 106 std::string HttpAuth::ChallengeTokenizer::base64_param() const { |
95 // Strip off any padding. | 107 // Strip off any padding. |
96 // (See https://bugzilla.mozilla.org/show_bug.cgi?id=230351.) | 108 // (See https://bugzilla.mozilla.org/show_bug.cgi?id=230351.) |
97 // | 109 // |
98 // Our base64 decoder requires that the length be a multiple of 4. | 110 // Our base64 decoder requires that the length be a multiple of 4. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 COMPILE_ASSERT(arraysize(kSchemeNames) == AUTH_SCHEME_MAX, | 187 COMPILE_ASSERT(arraysize(kSchemeNames) == AUTH_SCHEME_MAX, |
176 http_auth_scheme_names_incorrect_size); | 188 http_auth_scheme_names_incorrect_size); |
177 if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) { | 189 if (scheme < AUTH_SCHEME_BASIC || scheme >= AUTH_SCHEME_MAX) { |
178 NOTREACHED(); | 190 NOTREACHED(); |
179 return "invalid_scheme"; | 191 return "invalid_scheme"; |
180 } | 192 } |
181 return kSchemeNames[scheme]; | 193 return kSchemeNames[scheme]; |
182 } | 194 } |
183 | 195 |
184 } // namespace net | 196 } // namespace net |
OLD | NEW |