• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2011 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_
6 #define NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_
7 
8 #include <map>
9 #include <string>
10 
11 #include "net/base/ip_endpoint.h"
12 #include "net/base/net_export.h"
13 
14 namespace net {
15 
16 // Meta information about an HTTP request.
17 // This is geared toward servers in that it keeps a map of the headers and
18 // values rather than just a list of header strings (which net::HttpRequestInfo
19 // does).
20 class NET_EXPORT HttpServerRequestInfo {
21  public:
22   HttpServerRequestInfo();
23   HttpServerRequestInfo(const HttpServerRequestInfo& other);
24   ~HttpServerRequestInfo();
25 
26   // Returns header value for given header name. |header_name| should be
27   // lower case.
28   std::string GetHeaderValue(const std::string& header_name) const;
29 
30   // Checks for item in comma-separated header value for given header name.
31   // Both |header_name| and |header_value| should be lower case.
32   bool HasHeaderValue(
33       const std::string& header_name,
34       const std::string& header_value) const;
35 
36   // Request peer address.
37   IPEndPoint peer;
38 
39   // Request method.
40   std::string method;
41 
42   // Request line.
43   std::string path;
44 
45   // Request data.
46   std::string data;
47 
48   // A map of the names -> values for HTTP headers. These should always
49   // contain lower case field names.
50   using HeadersMap = std::map<std::string, std::string>;
51   HeadersMap headers;
52 };
53 
54 }  // namespace net
55 
56 #endif  // NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_
57