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

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

Issue 181063006: Gets the peer address (if available) in server requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed proto, other review fixes Created 6 years, 9 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
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 #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"
12
11 namespace net { 13 namespace net {
12 14
13 // Meta information about an HTTP request. 15 // Meta information about an HTTP request.
14 // 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
15 // 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
16 // does). 18 // does).
17 class HttpServerRequestInfo { 19 class HttpServerRequestInfo {
18 public: 20 public:
19 HttpServerRequestInfo(); 21 HttpServerRequestInfo();
20 ~HttpServerRequestInfo(); 22 ~HttpServerRequestInfo();
21 23
22 // Returns header value for given header name. |header_name| should be 24 // Returns header value for given header name. |header_name| should be
23 // lower case. 25 // lower case.
24 std::string GetHeaderValue(const std::string& header_name) const; 26 std::string GetHeaderValue(const std::string& header_name) const;
25 27
28 // Request protocol.
29 std::string proto;
Ryan Sleevi 2014/03/17 19:46:04 Did you mean to remove this?
gunsch 2014/03/17 20:26:29 Yep, thanks for catching. Done.
30
31 // Request peer address.
32 IPEndPoint peer;
33
26 // Request method. 34 // Request method.
27 std::string method; 35 std::string method;
28 36
29 // Request line. 37 // Request line.
30 std::string path; 38 std::string path;
31 39
32 // Request data. 40 // Request data.
33 std::string data; 41 std::string data;
34 42
35 // A map of the names -> values for HTTP headers. These should always 43 // A map of the names -> values for HTTP headers. These should always
36 // contain lower case field names. 44 // contain lower case field names.
37 typedef std::map<std::string, std::string> HeadersMap; 45 typedef std::map<std::string, std::string> HeadersMap;
38 mutable HeadersMap headers; 46 mutable HeadersMap headers;
39 }; 47 };
40 48
41 } // namespace net 49 } // namespace net
42 50
43 #endif // NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_ 51 #endif // NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698