| 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 // The rules for parsing content-types were borrowed from Firefox: | 5 // The rules for parsing content-types were borrowed from Firefox: |
| 6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 | 6 // http://lxr.mozilla.org/mozilla/source/netwerk/base/src/nsURLHelper.cpp#834 |
| 7 | 7 |
| 8 #include "net/http/http_util.h" | 8 #include "net/http/http_util.h" |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 } | 644 } |
| 645 | 645 |
| 646 HttpUtil::HeadersIterator::~HeadersIterator() { | 646 HttpUtil::HeadersIterator::~HeadersIterator() { |
| 647 } | 647 } |
| 648 | 648 |
| 649 bool HttpUtil::HeadersIterator::GetNext() { | 649 bool HttpUtil::HeadersIterator::GetNext() { |
| 650 while (lines_.GetNext()) { | 650 while (lines_.GetNext()) { |
| 651 name_begin_ = lines_.token_begin(); | 651 name_begin_ = lines_.token_begin(); |
| 652 values_end_ = lines_.token_end(); | 652 values_end_ = lines_.token_end(); |
| 653 | 653 |
| 654 string::const_iterator colon = find(name_begin_, values_end_, ':'); | 654 string::const_iterator colon = std::find(name_begin_, values_end_, ':'); |
| 655 if (colon == values_end_) | 655 if (colon == values_end_) |
| 656 continue; // skip malformed header | 656 continue; // skip malformed header |
| 657 | 657 |
| 658 name_end_ = colon; | 658 name_end_ = colon; |
| 659 | 659 |
| 660 // If the name starts with LWS, it is an invalid line. | 660 // If the name starts with LWS, it is an invalid line. |
| 661 // Leading LWS implies a line continuation, and these should have | 661 // Leading LWS implies a line continuation, and these should have |
| 662 // already been joined by AssembleRawHeaders(). | 662 // already been joined by AssembleRawHeaders(). |
| 663 if (name_begin_ == name_end_ || IsLWS(*name_begin_)) | 663 if (name_begin_ == name_end_ || IsLWS(*name_begin_)) |
| 664 continue; | 664 continue; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 value_is_quoted_ = true; | 786 value_is_quoted_ = true; |
| 787 // Do not store iterators into this. See declaration of unquoted_value_. | 787 // Do not store iterators into this. See declaration of unquoted_value_. |
| 788 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_); | 788 unquoted_value_ = HttpUtil::Unquote(value_begin_, value_end_); |
| 789 } | 789 } |
| 790 } | 790 } |
| 791 | 791 |
| 792 return true; | 792 return true; |
| 793 } | 793 } |
| 794 | 794 |
| 795 } // namespace net | 795 } // namespace net |
| OLD | NEW |