| OLD | NEW |
| 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 #include "net/http/http_auth_challenge_tokenizer.h" | 5 #include "net/http/http_auth_challenge_tokenizer.h" |
| 6 | 6 |
| 7 #include "base/strings/string_tokenizer.h" | 7 #include "base/strings/string_tokenizer.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 HttpAuthChallengeTokenizer::HttpAuthChallengeTokenizer( | 11 HttpAuthChallengeTokenizer::HttpAuthChallengeTokenizer( |
| 12 std::string::const_iterator begin, | 12 std::string::const_iterator begin, |
| 13 std::string::const_iterator end) | 13 std::string::const_iterator end) |
| 14 : begin_(begin), | 14 : begin_(begin), |
| 15 end_(end), | 15 end_(end), |
| 16 scheme_begin_(begin), | 16 scheme_begin_(begin), |
| 17 scheme_end_(begin), | 17 scheme_end_(begin), |
| 18 params_begin_(end), | 18 params_begin_(end), |
| 19 params_end_(end) { | 19 params_end_(end) { |
| 20 Init(begin, end); | 20 Init(begin, end); |
| 21 } | 21 } |
| 22 | 22 |
| 23 HttpAuthChallengeTokenizer::~HttpAuthChallengeTokenizer() { |
| 24 } |
| 25 |
| 23 HttpUtil::NameValuePairsIterator HttpAuthChallengeTokenizer::param_pairs() | 26 HttpUtil::NameValuePairsIterator HttpAuthChallengeTokenizer::param_pairs() |
| 24 const { | 27 const { |
| 25 return HttpUtil::NameValuePairsIterator(params_begin_, params_end_, ','); | 28 return HttpUtil::NameValuePairsIterator(params_begin_, params_end_, ','); |
| 26 } | 29 } |
| 27 | 30 |
| 28 std::string HttpAuthChallengeTokenizer::base64_param() const { | 31 std::string HttpAuthChallengeTokenizer::base64_param() const { |
| 29 // Strip off any padding. | 32 // Strip off any padding. |
| 30 // (See https://bugzilla.mozilla.org/show_bug.cgi?id=230351.) | 33 // (See https://bugzilla.mozilla.org/show_bug.cgi?id=230351.) |
| 31 // | 34 // |
| 32 // Our base64 decoder requires that the length be a multiple of 4. | 35 // Our base64 decoder requires that the length be a multiple of 4. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 52 // Save the scheme's position. | 55 // Save the scheme's position. |
| 53 scheme_begin_ = tok.token_begin(); | 56 scheme_begin_ = tok.token_begin(); |
| 54 scheme_end_ = tok.token_end(); | 57 scheme_end_ = tok.token_end(); |
| 55 | 58 |
| 56 params_begin_ = scheme_end_; | 59 params_begin_ = scheme_end_; |
| 57 params_end_ = end; | 60 params_end_ = end; |
| 58 HttpUtil::TrimLWS(¶ms_begin_, ¶ms_end_); | 61 HttpUtil::TrimLWS(¶ms_begin_, ¶ms_end_); |
| 59 } | 62 } |
| 60 | 63 |
| 61 } // namespace net | 64 } // namespace net |
| OLD | NEW |