[go: nahoru, domu]

blob: 1d221de03a880d14f5291082374d52caf2200559 [file] [log] [blame]
Avi Drissman64595482022-09-14 20:52:291// Copyright 2011 The Chromium Authors
pfeldman@chromium.org0569d862010-07-05 11:32:402// 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
erg@chromium.org5097dc82010-07-15 17:23:238#include <map>
tfarina@chromium.orgb6dbb0a2011-04-18 00:17:419#include <string>
10
gunsch@chromium.org0cbc29bd2014-03-20 21:51:4411#include "net/base/ip_endpoint.h"
12
tfarina@chromium.orgb6dbb0a2011-04-18 00:17:4113namespace net {
pfeldman@chromium.org0569d862010-07-05 11:32:4014
pfeldman@chromium.org0569d862010-07-05 11:32:4015// Meta information about an HTTP request.
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
18// does).
19class HttpServerRequestInfo {
20 public:
erg@google.com1889dc1b2010-10-14 22:03:1321 HttpServerRequestInfo();
vmpstracd23b72016-02-26 21:08:5522 HttpServerRequestInfo(const HttpServerRequestInfo& other);
erg@google.com1889dc1b2010-10-14 22:03:1323 ~HttpServerRequestInfo();
pfeldman@chromium.org0569d862010-07-05 11:32:4024
kkania@chromium.org7ab0ffdf2013-07-31 22:27:5925 // Returns header value for given header name. |header_name| should be
26 // lower case.
pfeldman@chromium.org86c6a0b52011-08-02 19:49:2527 std::string GetHeaderValue(const std::string& header_name) const;
28
vkuzkokov@chromium.orgbbae90f2014-05-10 19:20:3429 // Checks for item in comma-separated header value for given header name.
30 // Both |header_name| and |header_value| should be lower case.
31 bool HasHeaderValue(
32 const std::string& header_name,
33 const std::string& header_value) const;
34
gunsch@chromium.org0cbc29bd2014-03-20 21:51:4435 // Request peer address.
36 IPEndPoint peer;
37
pfeldman@chromium.org0569d862010-07-05 11:32:4038 // Request method.
39 std::string method;
40
41 // Request line.
42 std::string path;
43
44 // Request data.
45 std::string data;
46
kkania@chromium.org7ab0ffdf2013-07-31 22:27:5947 // A map of the names -> values for HTTP headers. These should always
48 // contain lower case field names.
David Benjamin3d11aad2019-12-02 18:11:4549 using HeadersMap = std::map<std::string, std::string>;
50 HeadersMap headers;
pfeldman@chromium.org0569d862010-07-05 11:32:4051};
52
tfarina@chromium.orgb6dbb0a2011-04-18 00:17:4153} // namespace net
54
pfeldman@chromium.org0569d862010-07-05 11:32:4055#endif // NET_SERVER_HTTP_SERVER_REQUEST_INFO_H_