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

Side by Side Diff: net/server/http_server_request_info.cc

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 8 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/server/http_server.cc ('k') | net/server/http_server_unittest.cc » ('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) 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 #include "net/server/http_server_request_info.h" 5 #include "net/server/http_server_request_info.h"
6 6
7 #include "base/strings/string_split.h"
7 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
8 9
9 namespace net { 10 namespace net {
10 11
11 HttpServerRequestInfo::HttpServerRequestInfo() {} 12 HttpServerRequestInfo::HttpServerRequestInfo() {}
12 13
13 HttpServerRequestInfo::~HttpServerRequestInfo() {} 14 HttpServerRequestInfo::~HttpServerRequestInfo() {}
14 15
15 std::string HttpServerRequestInfo::GetHeaderValue( 16 std::string HttpServerRequestInfo::GetHeaderValue(
16 const std::string& header_name) const { 17 const std::string& header_name) const {
17 DCHECK_EQ(base::StringToLowerASCII(header_name), header_name); 18 DCHECK_EQ(base::StringToLowerASCII(header_name), header_name);
18 HttpServerRequestInfo::HeadersMap::const_iterator it = 19 HttpServerRequestInfo::HeadersMap::const_iterator it =
19 headers.find(header_name); 20 headers.find(header_name);
20 if (it != headers.end()) 21 if (it != headers.end())
21 return it->second; 22 return it->second;
22 return std::string(); 23 return std::string();
23 } 24 }
24 25
25 bool HttpServerRequestInfo::HasHeaderValue( 26 bool HttpServerRequestInfo::HasHeaderValue(
26 const std::string& header_name, 27 const std::string& header_name,
27 const std::string& header_value) const { 28 const std::string& header_value) const {
28 DCHECK_EQ(base::StringToLowerASCII(header_value), header_value); 29 DCHECK_EQ(base::StringToLowerASCII(header_value), header_value);
29 std::string complete_value = GetHeaderValue(header_name); 30 std::string complete_value = GetHeaderValue(header_name);
30 base::StringToLowerASCII(&complete_value); 31 base::StringToLowerASCII(&complete_value);
31 std::vector<std::string> value_items; 32
32 Tokenize(complete_value, ",", &value_items); 33 for (const base::StringPiece& cur :
33 for (std::vector<std::string>::iterator it = value_items.begin(); 34 base::SplitString(complete_value, ",", base::KEEP_WHITESPACE,
34 it != value_items.end(); ++it) { 35 base::SPLIT_WANT_NONEMPTY)) {
35 base::TrimString(*it, " \t", &*it); 36 if (base::TrimString(cur, " \t", base::TRIM_ALL) == header_value)
36 if (*it == header_value)
37 return true; 37 return true;
38 } 38 }
39 return false; 39 return false;
40 } 40 }
41 41
42 } // namespace net 42 } // namespace net
OLDNEW
« no previous file with comments | « net/server/http_server.cc ('k') | net/server/http_server_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698