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

Side by Side Diff: net/tools/balsa/balsa_headers_token_utils.cc

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 years, 5 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/tools/balsa/balsa_frame.cc ('k') | net/tools/balsa/string_piece_utils.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/tools/balsa/balsa_headers_token_utils.h" 5 #include "net/tools/balsa/balsa_headers_token_utils.h"
6 #include "net/tools/balsa/string_piece_utils.h"
7 6
8 namespace net { 7 namespace net {
9 8
10 inline void BalsaHeadersTokenUtils::TokenizeHeaderLine( 9 inline void BalsaHeadersTokenUtils::TokenizeHeaderLine(
11 const BalsaHeaders& headers, 10 const BalsaHeaders& headers,
12 const BalsaHeaders::HeaderLineDescription& header_line, 11 const BalsaHeaders::HeaderLineDescription& header_line,
13 BalsaHeaders::HeaderTokenList* tokens) { 12 BalsaHeaders::HeaderTokenList* tokens) {
14 CHECK(tokens); 13 CHECK(tokens);
15 14
16 // Find where this line is stored 15 // Find where this line is stored
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 ++it; 78 ++it;
80 } 79 }
81 while (it != headers.header_lines_key_end()); 80 while (it != headers.header_lines_key_end());
82 81
83 // Tokenize just that line 82 // Tokenize just that line
84 BalsaHeaders::HeaderTokenList tokens; 83 BalsaHeaders::HeaderTokenList tokens;
85 ParseTokenList(header_line->second.begin(), header_line->second.end(), 84 ParseTokenList(header_line->second.begin(), header_line->second.end(),
86 &tokens); 85 &tokens);
87 86
88 return !tokens.empty() && 87 return !tokens.empty() &&
89 StringPieceUtils::StartsWithIgnoreCase(tokens.back(), token); 88 base::StartsWith(tokens.back(), token,
89 base::CompareCase::INSENSITIVE_ASCII);
90 } 90 }
91 91
92 void BalsaHeadersTokenUtils::TokenizeHeaderValue( 92 void BalsaHeadersTokenUtils::TokenizeHeaderValue(
93 const BalsaHeaders& headers, 93 const BalsaHeaders& headers,
94 const base::StringPiece& key, 94 const base::StringPiece& key,
95 BalsaHeaders::HeaderTokenList* tokens) { 95 BalsaHeaders::HeaderTokenList* tokens) {
96 CHECK(tokens); 96 CHECK(tokens);
97 tokens->clear(); 97 tokens->clear();
98 98
99 // We may have more then 1 line with the same header key. Tokenize them all 99 // We may have more then 1 line with the same header key. Tokenize them all
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 133 }
134 return; 134 return;
135 } 135 }
136 } 136 }
137 tokens->push_back(base::StringPiece(nws, start - nws)); 137 tokens->push_back(base::StringPiece(nws, start - nws));
138 } 138 }
139 } 139 }
140 140
141 } // namespace net 141 } // namespace net
142 142
OLDNEW
« no previous file with comments | « net/tools/balsa/balsa_frame.cc ('k') | net/tools/balsa/string_piece_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698