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

Side by Side Diff: net/http/http_util.cc

Issue 3452030: FBTF: Moves code to the headers. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 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_util.h ('k') | net/spdy/spdy_settings_storage.h » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 // and consisting of either *TEXT or combinations 624 // and consisting of either *TEXT or combinations
625 // of token, separators, and quoted-string> 625 // of token, separators, and quoted-string>
626 // 626 //
627 627
628 HttpUtil::HeadersIterator::HeadersIterator(string::const_iterator headers_begin, 628 HttpUtil::HeadersIterator::HeadersIterator(string::const_iterator headers_begin,
629 string::const_iterator headers_end, 629 string::const_iterator headers_end,
630 const std::string& line_delimiter) 630 const std::string& line_delimiter)
631 : lines_(headers_begin, headers_end, line_delimiter) { 631 : lines_(headers_begin, headers_end, line_delimiter) {
632 } 632 }
633 633
634 HttpUtil::HeadersIterator::~HeadersIterator() {
635 }
636
634 bool HttpUtil::HeadersIterator::GetNext() { 637 bool HttpUtil::HeadersIterator::GetNext() {
635 while (lines_.GetNext()) { 638 while (lines_.GetNext()) {
636 name_begin_ = lines_.token_begin(); 639 name_begin_ = lines_.token_begin();
637 values_end_ = lines_.token_end(); 640 values_end_ = lines_.token_end();
638 641
639 string::const_iterator colon = find(name_begin_, values_end_, ':'); 642 string::const_iterator colon = find(name_begin_, values_end_, ':');
640 if (colon == values_end_) 643 if (colon == values_end_)
641 continue; // skip malformed header 644 continue; // skip malformed header
642 645
643 name_end_ = colon; 646 name_end_ = colon;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 } 679 }
677 680
678 HttpUtil::ValuesIterator::ValuesIterator( 681 HttpUtil::ValuesIterator::ValuesIterator(
679 string::const_iterator values_begin, 682 string::const_iterator values_begin,
680 string::const_iterator values_end, 683 string::const_iterator values_end,
681 char delimiter) 684 char delimiter)
682 : values_(values_begin, values_end, string(1, delimiter)) { 685 : values_(values_begin, values_end, string(1, delimiter)) {
683 values_.set_quote_chars("\'\""); 686 values_.set_quote_chars("\'\"");
684 } 687 }
685 688
689 HttpUtil::ValuesIterator::~ValuesIterator() {
690 }
691
686 bool HttpUtil::ValuesIterator::GetNext() { 692 bool HttpUtil::ValuesIterator::GetNext() {
687 while (values_.GetNext()) { 693 while (values_.GetNext()) {
688 value_begin_ = values_.token_begin(); 694 value_begin_ = values_.token_begin();
689 value_end_ = values_.token_end(); 695 value_end_ = values_.token_end();
690 TrimLWS(&value_begin_, &value_end_); 696 TrimLWS(&value_begin_, &value_end_);
691 697
692 // bypass empty values. 698 // bypass empty values.
693 if (value_begin_ != value_end_) 699 if (value_begin_ != value_end_)
694 return true; 700 return true;
695 } 701 }
696 return false; 702 return false;
697 } 703 }
698 704
699 } // namespace net 705 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_util.h ('k') | net/spdy/spdy_settings_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698