28 #ifndef HTTP_CONSTANTS_HPP
29 #define HTTP_CONSTANTS_HPP
80 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
81 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
82 0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,
83 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
84 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
85 1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,
86 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
87 1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,
88 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
89 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
90 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
91 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
92 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
93 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
94 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
95 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
113 return (c == 9 || c == 32);
118 return (c != 9 && c != 32);
128 switching_protocols = 101,
133 non_authoritative_information = 203,
136 partial_content = 206,
138 multiple_choices = 300,
139 moved_permanently = 301,
144 temporary_redirect = 307,
148 payment_required = 402,
151 method_not_allowed = 405,
152 not_acceptable = 406,
153 proxy_authentication_required = 407,
154 request_timeout = 408,
157 length_required = 411,
158 precondition_failed = 412,
159 request_entity_too_large = 413,
160 request_uri_too_long = 414,
161 unsupported_media_type = 415,
162 request_range_not_satisfiable = 416,
163 expectation_failed = 417,
165 upgrade_required = 426,
166 precondition_required = 428,
167 too_many_requests = 429,
168 request_header_fields_too_large = 431,
170 internal_server_error = 500,
171 not_implemented = 501,
173 service_unavailable = 503,
174 gateway_timeout = 504,
175 http_version_not_supported = 505,
177 network_authentication_required = 511
190 return "Uninitialized";
193 case switching_protocols:
194 return "Switching Protocols";
201 case non_authoritative_information:
202 return "Non Authoritative Information";
206 return "Reset Content";
207 case partial_content:
208 return "Partial Content";
209 case multiple_choices:
210 return "Multiple Choices";
211 case moved_permanently:
212 return "Moved Permanently";
218 return "Not Modified";
221 case temporary_redirect:
222 return "Temporary Redirect";
224 return "Bad Request";
226 return "Unauthorized";
227 case payment_required:
228 return "Payment Required";
233 case method_not_allowed:
234 return "Method Not Allowed";
236 return "Not Acceptable";
237 case proxy_authentication_required:
238 return "Proxy Authentication Required";
239 case request_timeout:
240 return "Request Timeout";
245 case length_required:
246 return "Length Required";
247 case precondition_failed:
248 return "Precondition Failed";
249 case request_entity_too_large:
250 return "Request Entity Too Large";
251 case request_uri_too_long:
252 return "Request-URI Too Long";
253 case unsupported_media_type:
254 return "Unsupported Media Type";
255 case request_range_not_satisfiable:
256 return "Requested Range Not Satisfiable";
257 case expectation_failed:
258 return "Expectation Failed";
260 return "I'm a teapot";
261 case upgrade_required:
262 return "Upgrade Required";
263 case precondition_required:
264 return "Precondition Required";
265 case too_many_requests:
266 return "Too Many Requests";
267 case request_header_fields_too_large:
268 return "Request Header Fields Too Large";
269 case internal_server_error:
270 return "Internal Server Error";
271 case not_implemented:
272 return "Not Implemented";
274 return "Bad Gateway";
275 case service_unavailable:
276 return "Service Unavailable";
277 case gateway_timeout:
278 return "Gateway Timeout";
279 case http_version_not_supported:
280 return "HTTP Version Not Supported";
282 return "Not Extended";
283 case network_authentication_required:
284 return "Network Authentication Required";
300 exception(
const std::string& log_msg,
302 const std::string& error_msg = std::string(),
303 const std::string& body = std::string())
305 , m_error_msg(error_msg)
307 , m_error_code(error_code) {}
309 ~exception()
throw() {}
311 virtual const char* what()
const throw() {
312 return m_msg.c_str();
316 std::string m_error_msg;
337 class category :
public lib::error_category {
339 char const * name()
const _WEBSOCKETPP_NOEXCEPT_TOKEN_ {
340 return "websocketpp.http";
343 std::string message(
int value)
const {
346 return "Generic http parser error";
347 case error::invalid_header_name:
348 return "The header name specified contains illegal characters";
349 case error::body_too_large:
350 return "The body value is larger than the configured maximum size";
359 static category instance;
365 return lib::error_code(
static_cast<
int>(e), get_category());
372 _WEBSOCKETPP_ERROR_CODE_ENUM_NS_START_
373 template<>
struct is_error_code_enum<websocketpp::transport::asio::error::value>
375 static bool const value =
true;
377 _WEBSOCKETPP_ERROR_CODE_ENUM_NS_END_