Adding Baseframework of the ResourceManager (all hooks and observers)
[chromium-blink-merge.git] / net / server / http_server_request_info.cc
blob23729b210046e44bd56560f5536226bcb045f10f
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
3 // found in the LICENSE file.
5 #include "net/server/http_server_request_info.h"
7 #include "base/strings/string_util.h"
9 namespace net {
11 HttpServerRequestInfo::HttpServerRequestInfo() {}
13 HttpServerRequestInfo::~HttpServerRequestInfo() {}
15 std::string HttpServerRequestInfo::GetHeaderValue(
16 const std::string& header_name) const {
17 DCHECK_EQ(base::StringToLowerASCII(header_name), header_name);
18 HttpServerRequestInfo::HeadersMap::const_iterator it =
19 headers.find(header_name);
20 if (it != headers.end())
21 return it->second;
22 return std::string();
25 bool HttpServerRequestInfo::HasHeaderValue(
26 const std::string& header_name,
27 const std::string& header_value) const {
28 DCHECK_EQ(base::StringToLowerASCII(header_value), header_value);
29 std::string complete_value = GetHeaderValue(header_name);
30 base::StringToLowerASCII(&complete_value);
31 std::vector<std::string> value_items;
32 Tokenize(complete_value, ",", &value_items);
33 for (std::vector<std::string>::iterator it = value_items.begin();
34 it != value_items.end(); ++it) {
35 base::TrimString(*it, " \t", &*it);
36 if (*it == header_value)
37 return true;
39 return false;
42 } // namespace net