9 #ifndef INCLUDE_FUNAPI_NETWORK_HTTP_UTIL_H_ 10 #define INCLUDE_FUNAPI_NETWORK_HTTP_UTIL_H_ 12 #include <boost/algorithm/string/predicate.hpp> 23 typedef std::multimap<string, string, impl::util::CaseInsensitiveLess>
Header;
26 typedef std::map<string, string, impl::util::CaseInsensitiveLess>
GetParameter;
29 typedef std::map<string, std::vector<string>,
65 kSwitchingProtocols = 101,
69 kNonAuthoritativeInformation = 203,
72 kPartialContent = 206,
73 kMultipleChoices = 300,
74 kMovedPermanently = 301,
79 kTemporaryRedirect = 307,
82 kPaymentRequired = 402,
85 kMethodNotAllowed = 405,
87 kProxyAuthenticationRequired = 407,
88 kRequestTimeout = 408,
91 kLengthRequired = 411,
92 kPreconditionFailed = 412,
93 kRequestEntityTooLarge = 413,
94 kRequestUriTooLong = 414,
95 kUnsupportedMediaType = 415,
96 kRequestRangeNotSatisfiable = 416,
97 kExpectationFailed = 417,
98 kTooManyRequests = 429,
99 kInternalServerError = 500,
100 kNotImplemented = 501,
102 kServiceUnavailable = 503,
103 kGatewayTimeout = 504,
104 kHttpVersionNotSupported = 505
161 class FUNAPI_DLL_VISIBILITY
Uri {
169 explicit Uri(
const string &uri_string);
175 Uri &operator=(
const Uri &rhs);
179 bool Parse(
const string &uri_string);
183 const string &protocol()
const;
187 const string &host()
const;
191 uint16_t port()
const;
195 const string &path()
const;
199 const string &query_string()
const;
203 const string &raw()
const;
212 string query_string_;
231 FUNAPI_DLL_VISIBILITY
bool Escape(
const string &plain,
string *out);
237 FUNAPI_DLL_VISIBILITY
bool Unescape(
const string &url_encoded,
string *out);
242 #endif // INCLUDE_FUNAPI_NETWORK_HTTP_UTIL_H_ HTTP/1.0.
Definition: http_util.h:49
Data structure to hold HTTP request.
Definition: http_util.h:123
Method method
HTTP method.
Definition: http_util.h:112
StatusCode
Enum representing HTTP status code.
Definition: http_util.h:63
Header header
header fields
Definition: http_util.h:131
HTTP.
Definition: http_util.h:56
Invalid version.
Definition: http_util.h:48
TRACE method.
Definition: http_util.h:41
string body
request body
Definition: http_util.h:132
std::multimap< string, string, impl::util::CaseInsensitiveLess > Header
Datastructure to hold http header fields.
Definition: http_util.h:23
Version version
HTTP version.
Definition: http_util.h:140
DELETE method.
Definition: http_util.h:40
GetParameter get_parameter
Parameter if GET method.
Definition: http_util.h:116
uint32_t status_code
Response result.
Definition: http_util.h:141
std::map< string, string, impl::util::CaseInsensitiveLess > GetParameter
Datastructure to hold paramester associated HTTP GET method.
Definition: http_util.h:26
Invalid method.
Definition: http_util.h:35
string body
request body
Definition: http_util.h:118
Protocol
Enum type representing HTTP protocol type.
Definition: http_util.h:55
std::map< string, std::vector< string >, impl::util::CaseInsensitiveLess > GetParameter2
Datastructure to hold multiple value paramester associated HTTP GET method.
Definition: http_util.h:30
GET method.
Definition: http_util.h:36
PUT method.
Definition: http_util.h:39
HEAD method.
Definition: http_util.h:37
string body
response body
Definition: http_util.h:144
Version
Enum type representing HTTP version.
Definition: http_util.h:47
POST method.
Definition: http_util.h:38
Data structure to hold HTTP response.
Definition: http_util.h:137
HTTP/1.1.
Definition: http_util.h:50
Class to parse an URI string.
Definition: http_util.h:161
string request_uri
Request URI.
Definition: http_util.h:128
FUNAPI_DLL_VISIBILITY const string & GetMethodString(const Method &method)
Converts an HTTP method to string.
string request_ip
Request IP.
Definition: http_util.h:113
string status_message
message matching status_code
Definition: http_util.h:142
HTTPS.
Definition: http_util.h:57
FUNAPI_DLL_VISIBILITY bool Escape(const string &plain, string *out)
Converts the given string to a URL encoded string.
Header header
header fields
Definition: http_util.h:117
Version version
HTTP version.
Definition: http_util.h:129
string request_uri
Request URI.
Definition: http_util.h:114
Header header
header fields
Definition: http_util.h:143
Method
Enum type representing HTTP methods.
Definition: http_util.h:34
Version version
HTTP version.
Definition: http_util.h:115
OPTIONS method.
Definition: http_util.h:42
FUNAPI_DLL_VISIBILITY const string & GetStatusCodeString(int status_code)
Converts an HTTP status code to string.
#define DECLARE_CLASS_PTR(CLS)
Utility macro to forward-declare smart pointer types for a given class.
Definition: types.h:89
FUNAPI_DLL_VISIBILITY bool Unescape(const string &url_encoded, string *out)
Converts the given string to a URL decoded string.
Method method
HTTP method.
Definition: http_util.h:126
string request_ip
Request IP.
Definition: http_util.h:127
GetParameter2 get_parameter
Parameter if GET method.
Definition: http_util.h:130
Data structure to hold HTTP request.
Definition: http_util.h:109