OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_request_headers.h" | 5 #include "net/http/http_request_headers.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 } | 234 } |
235 headers->AddHeaderFromString(header_line); | 235 headers->AddHeaderFromString(header_line); |
236 } | 236 } |
237 return true; | 237 return true; |
238 } | 238 } |
239 | 239 |
240 HttpRequestHeaders::HeaderVector::iterator | 240 HttpRequestHeaders::HeaderVector::iterator |
241 HttpRequestHeaders::FindHeader(const base::StringPiece& key) { | 241 HttpRequestHeaders::FindHeader(const base::StringPiece& key) { |
242 for (HeaderVector::iterator it = headers_.begin(); | 242 for (HeaderVector::iterator it = headers_.begin(); |
243 it != headers_.end(); ++it) { | 243 it != headers_.end(); ++it) { |
244 if (key.length() == it->key.length() && | 244 if (base::EqualsCaseInsensitiveASCII(key, it->key)) |
245 !base::strncasecmp(key.data(), it->key.data(), key.length())) | |
246 return it; | 245 return it; |
247 } | 246 } |
248 | 247 |
249 return headers_.end(); | 248 return headers_.end(); |
250 } | 249 } |
251 | 250 |
252 HttpRequestHeaders::HeaderVector::const_iterator | 251 HttpRequestHeaders::HeaderVector::const_iterator |
253 HttpRequestHeaders::FindHeader(const base::StringPiece& key) const { | 252 HttpRequestHeaders::FindHeader(const base::StringPiece& key) const { |
254 for (HeaderVector::const_iterator it = headers_.begin(); | 253 for (HeaderVector::const_iterator it = headers_.begin(); |
255 it != headers_.end(); ++it) { | 254 it != headers_.end(); ++it) { |
256 if (key.length() == it->key.length() && | 255 if (base::EqualsCaseInsensitiveASCII(key, it->key)) |
257 !base::strncasecmp(key.data(), it->key.data(), key.length())) | |
258 return it; | 256 return it; |
259 } | 257 } |
260 | 258 |
261 return headers_.end(); | 259 return headers_.end(); |
262 } | 260 } |
263 | 261 |
264 } // namespace net | 262 } // namespace net |
OLD | NEW |