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 #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_split.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
11 | 11 |
12 HttpServerRequestInfo::HttpServerRequestInfo() {} | 12 HttpServerRequestInfo::HttpServerRequestInfo() {} |
13 | 13 |
14 HttpServerRequestInfo::~HttpServerRequestInfo() {} | 14 HttpServerRequestInfo::~HttpServerRequestInfo() {} |
15 | 15 |
16 std::string HttpServerRequestInfo::GetHeaderValue( | 16 std::string HttpServerRequestInfo::GetHeaderValue( |
17 const std::string& header_name) const { | 17 const std::string& header_name) const { |
18 DCHECK_EQ(base::StringToLowerASCII(header_name), header_name); | 18 DCHECK_EQ(base::ToLowerASCII(header_name), header_name); |
19 HttpServerRequestInfo::HeadersMap::const_iterator it = | 19 HttpServerRequestInfo::HeadersMap::const_iterator it = |
20 headers.find(header_name); | 20 headers.find(header_name); |
21 if (it != headers.end()) | 21 if (it != headers.end()) |
22 return it->second; | 22 return it->second; |
23 return std::string(); | 23 return std::string(); |
24 } | 24 } |
25 | 25 |
26 bool HttpServerRequestInfo::HasHeaderValue( | 26 bool HttpServerRequestInfo::HasHeaderValue( |
27 const std::string& header_name, | 27 const std::string& header_name, |
28 const std::string& header_value) const { | 28 const std::string& header_value) const { |
29 DCHECK_EQ(base::StringToLowerASCII(header_value), header_value); | 29 DCHECK_EQ(base::ToLowerASCII(header_value), header_value); |
30 std::string complete_value = GetHeaderValue(header_name); | 30 std::string complete_value = base::ToLowerASCII(GetHeaderValue(header_name)); |
31 base::StringToLowerASCII(&complete_value); | |
32 | 31 |
33 for (const base::StringPiece& cur : | 32 for (const base::StringPiece& cur : |
34 base::SplitString(complete_value, ",", base::KEEP_WHITESPACE, | 33 base::SplitString(complete_value, ",", base::KEEP_WHITESPACE, |
35 base::SPLIT_WANT_NONEMPTY)) { | 34 base::SPLIT_WANT_NONEMPTY)) { |
36 if (base::TrimString(cur, " \t", base::TRIM_ALL) == header_value) | 35 if (base::TrimString(cur, " \t", base::TRIM_ALL) == header_value) |
37 return true; | 36 return true; |
38 } | 37 } |
39 return false; | 38 return false; |
40 } | 39 } |
41 | 40 |
42 } // namespace net | 41 } // namespace net |
OLD | NEW |