28 #ifndef HTTP_CONSTANTS_HPP 29 #define HTTP_CONSTANTS_HPP 79 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
80 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
81 0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,
82 1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
83 0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
84 1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,
85 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
86 1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0,
87 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,
99 return (header_token[c] == 1);
104 return !header_token[c];
112 return (c == 9 || c == 32);
117 return (c != 9 && c != 32);
121 namespace status_code {
182 return "Uninitialized";
186 return "Switching Protocols";
194 return "Non Authoritative Information";
198 return "Reset Content";
200 return "Partial Content";
202 return "Multiple Choices";
204 return "Moved Permanently";
210 return "Not Modified";
214 return "Temporary Redirect";
216 return "Bad Request";
218 return "Unauthorized";
220 return "Payment Required";
226 return "Method Not Allowed";
228 return "Not Acceptable";
230 return "Proxy Authentication Required";
232 return "Request Timeout";
238 return "Length Required";
240 return "Precondition Failed";
242 return "Request Entity Too Large";
244 return "Request-URI Too Long";
246 return "Unsupported Media Type";
248 return "Requested Range Not Satisfiable";
250 return "Expectation Failed";
252 return "I'm a teapot";
254 return "Upgrade Required";
256 return "Precondition Required";
258 return "Too Many Requests";
260 return "Request Header Fields Too Large";
262 return "Internal Server Error";
264 return "Not Implemented";
266 return "Bad Gateway";
268 return "Service Unavailable";
270 return "Gateway Timeout";
272 return "HTTP Version Not Supported";
274 return "Not Extended";
276 return "Network Authentication Required";
287 const std::string& error_msg = std::string(),
288 const std::string& body = std::string())
290 , m_error_msg(error_msg)
292 , m_error_code(error_code) {}
296 virtual const char*
what()
const throw() {
297 return m_msg.c_str();
308 #endif // HTTP_CONSTANTS_HPP
static std::string const empty_header
Literal value of an empty header.
bool is_not_whitespace_char(unsigned char c)
Is the character non-whitespace.
std::string get_string(value c)
status_code::value m_error_code
static char const header_delimiter[]
Literal value of the HTTP header delimiter.
std::vector< std::pair< std::string, attribute_list > > parameter_list
The type of an HTTP parameter list.
exception(const std::string &log_msg, status_code::value error_code, const std::string &error_msg=std::string(), const std::string &body=std::string())
bool is_not_token_char(unsigned char c)
Is the character a non-token.
virtual const char * what() const
static char const header_separator[]
Literal value of the HTTP header separator.
size_t const istream_buffer
Number of bytes to use for temporary istream read buffers.
static char const header_token[]
invalid HTTP token characters
Namespace for the WebSocket++ project.
size_t const max_header_size
Maximum size in bytes before rejecting an HTTP header as too big.
std::map< std::string, std::string > attribute_list
The type of an HTTP attribute list.
bool is_token_char(unsigned char c)
Is the character a token.
bool is_whitespace_char(unsigned char c)
Is the character whitespace.
size_t const max_body_size
Default Maximum size in bytes for HTTP message bodies.