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 #ifndef NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_ | 5 #ifndef NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_ |
6 #define NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_ | 6 #define NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "net/base/ip_endpoint.h" | 11 #include "net/base/ip_endpoint.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 // Meta information about an HTTP request. | 15 // Meta information about an HTTP request. |
16 // This is geared toward servers in that it keeps a map of the headers and | 16 // This is geared toward servers in that it keeps a map of the headers and |
17 // values rather than just a list of header strings (which net::HttpRequestInfo | 17 // values rather than just a list of header strings (which net::HttpRequestInfo |
18 // does). | 18 // does). |
19 class HttpServerRequestInfo { | 19 class HttpServerRequestInfo { |
20 public: | 20 public: |
21 HttpServerRequestInfo(); | 21 HttpServerRequestInfo(); |
22 ~HttpServerRequestInfo(); | 22 ~HttpServerRequestInfo(); |
23 | 23 |
24 // Returns header value for given header name. |header_name| should be | 24 // Returns header value for given header name. |header_name| should be |
25 // lower case. | 25 // lower case. |
26 std::string GetHeaderValue(const std::string& header_name) const; | 26 std::string GetHeaderValue(const std::string& header_name) const; |
27 | 27 |
| 28 // Checks for item in comma-separated header value for given header name. |
| 29 // Both |header_name| and |header_value| should be lower case. |
| 30 bool HasHeaderValue( |
| 31 const std::string& header_name, |
| 32 const std::string& header_value) const; |
| 33 |
28 // Request peer address. | 34 // Request peer address. |
29 IPEndPoint peer; | 35 IPEndPoint peer; |
30 | 36 |
31 // Request method. | 37 // Request method. |
32 std::string method; | 38 std::string method; |
33 | 39 |
34 // Request line. | 40 // Request line. |
35 std::string path; | 41 std::string path; |
36 | 42 |
37 // Request data. | 43 // Request data. |
38 std::string data; | 44 std::string data; |
39 | 45 |
40 // A map of the names -> values for HTTP headers. These should always | 46 // A map of the names -> values for HTTP headers. These should always |
41 // contain lower case field names. | 47 // contain lower case field names. |
42 typedef std::map<std::string, std::string> HeadersMap; | 48 typedef std::map<std::string, std::string> HeadersMap; |
43 mutable HeadersMap headers; | 49 mutable HeadersMap headers; |
44 }; | 50 }; |
45 | 51 |
46 } // namespace net | 52 } // namespace net |
47 | 53 |
48 #endif // NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_ | 54 #endif // NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_ |
OLD | NEW |