identt
ServerRequest.hpp
Go to the documentation of this file.
1 
34 #ifndef _IDENTT_HTTP_SERVER_REQUEST_HPP_
35 #define _IDENTT_HTTP_SERVER_REQUEST_HPP_
36 
37 #include <boost/algorithm/string/predicate.hpp>
38 #include <boost/functional/hash.hpp>
39 #include <unordered_map>
40 #include <sstream>
41 #ifdef USE_BOOST_REGEX
42 #include <boost/regex.hpp>
43 #define REGEX_NS boost
44 #else
45 #include <regex>
46 #define REGEX_NS std
47 #endif
48 
49 #include "ServerContent.hpp"
50 
51 namespace identt {
52 namespace http {
53 
54 struct ServerRequest {
55  using Content=ServerContent;
56  //Based on http://www.boost.org/doc/libs/1_60_0/doc/html/unordered/hash_equality.html
57  struct iequal_to {
58  bool operator()(const std::string &key1, const std::string &key2) const
59  {
60  return boost::algorithm::iequals(key1, key2);
61  }
62  };
63  struct ihash {
64  size_t operator()(const std::string &key) const
65  {
66  std::size_t seed=0;
67  for(auto &c: key)
68  boost::hash_combine(seed, std::tolower(c));
69  return seed;
70  }
71  };
72  ServerRequest(): content(streambuf) {}
73  std::string remote_endpoint_address;
74  unsigned short remote_endpoint_port;
75  std::string method, path, http_version;
76  Content content;
77  std::unordered_multimap<std::string, std::string, ihash, iequal_to> header;
78  REGEX_NS::smatch path_match;
79  boost::asio::streambuf streambuf;
80 };
81 } // namespace http
82 } // namespace identt
83 #endif /* _IDENTT_HTTP_SERVER_REQUEST_HPP_ */
Definition: ServerRequest.hpp:54
Definition: ServerContent.hpp:42
Definition: CryptoBase.hpp:49
Definition: ServerRequest.hpp:57
Definition: ServerRequest.hpp:63