len) + \
COMPILE_STRLEN(CONF_MSG__FMT_303_BEG) + \
COMPILE_STRLEN(CONF_MSG__FMT_303_END))
#define CONF_LINE_RET_307 "Temporary Redirect"
#define CONF_MSG_FMT_307 "%s${vstr:%p%zu%zu%u}%s"
#define CONF_MSG__FMT_307_BEG CONF_MSG_RET_BEG "\
307 Temporary Redirect\r\n\
\r\n\
\r\n\
307 Temporary Redirect
\r\n\
The document has temporarily moved len) + \
COMPILE_STRLEN(CONF_MSG__FMT_307_BEG) + \
COMPILE_STRLEN(CONF_MSG__FMT_307_END))
#define CONF_LINE_RET_400 "Bad Request"
#define CONF_MSG_RET_400 \
CONF_MSG__MAKE(400, "The request could not be understood")
#define CONF_LINE_RET_401 "Unauthorized"
#define CONF_MSG_RET_401 \
CONF_MSG__MAKE(401, "The request requires user authentication")
#define CONF_LINE_RET_403 "Forbidden"
#define CONF_MSG_RET_403 \
CONF_MSG__MAKE(403, "The request is forbidden")
#define CONF_LINE_RET_404 "Not Found"
#define CONF_MSG_RET_404 \
CONF_MSG__MAKE(404, "The document requested was not found")
#define CONF_LINE_RET_405 "Method Not Allowed"
#define CONF_MSG_RET_405 \
CONF_MSG__MAKE(405, "The method specified is not allowed")
#define CONF_LINE_RET_406 "Not Acceptable"
#define CONF_MSG_RET_406 \
CONF_MSG__MAKE(406, "The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request")
#define CONF_LINE_RET_410 "Gone"
#define CONF_MSG_RET_410 \
CONF_MSG__MAKE(410, "The requested resource is no longer available at the server and no forwarding address is known. This condition is expected to be considered permanent")
#define CONF_LINE_RET_411 "Length Required"
#define CONF_MSG_RET_411 \
CONF_MSG__MAKE(411, "The server refuses to accept the request without a defined Content-Length")
#define CONF_LINE_RET_412 "Precondition Failed"
#define CONF_MSG_RET_412 \
CONF_MSG__MAKE(412, "The precondition given in one or more of the request-header fields evaluated to false")
#define CONF_LINE_RET_413 "Request Entity Too Large"
#define CONF_MSG_RET_413 \
CONF_MSG__MAKE(413, "The server does not accept any requests with Content (In other words if either a Content-Length or a Transfer-Encoding header is passed to the server, the request will fail)")
#define CONF_LINE_RET_414 "Request-URI Too Long"
#define CONF_MSG_RET_414 \
CONF_MSG__MAKE(414, "The document request was too long")
#define CONF_LINE_RET_415 "Unsupported Media Type"
#define CONF_MSG_RET_415 \
CONF_MSG__MAKE(415, "The server is refusing to service the request because the result of the request is in a format not supported, by the request")
#define CONF_LINE_RET_416 "Requested Range Not Satisfiable"
#define CONF_MSG_RET_416 \
CONF_MSG__MAKE(416, "The document request range was not valid")
#define CONF_LINE_RET_417 "Expectation Failed"
#define CONF_MSG_RET_417 \
CONF_MSG__MAKE(417, "The expectation given in an Expect request-header field could not be met by this server")
#define CONF_LINE_RET_500 "Internal Server Error"
#define CONF_MSG_RET_500 \
CONF_MSG__MAKE(500, "The server encountered something unexpected")
#define CONF_LINE_RET_501 "Not Implemented"
#define CONF_MSG_RET_501 \
CONF_MSG__MAKE(501, "The request method is not implemented")
#define CONF_LINE_RET_503 "Service Unavailable"
#define CONF_MSG_RET_503 \
CONF_MSG__MAKE(503, "The server is currently unable to handle the request due to a temporary overloading or maintenance of the server")
#define CONF_LINE_RET_505 "Version not supported"
#define CONF_MSG_RET_505 \
CONF_MSG__MAKE(505, "The version of http used is not supported")
#define HTTPD_REDIR_MSG(req, code, xmsg) do { \
(req)->error_xmsg = xmsg; \
(req)->error_code = (code); \
if (!req->policy->use_text_redirect) \
(req)->error_len = CONF_MSG_LEN_ ## code ((req)->fname); \
else \
(req)->error_len = (req)->fname->len + 1; \
(req)->error_line = CONF_LINE_RET_ ## code; \
} while (0)
#define HTTPD_ERR(req, code) do { \
(req)->error_code = (code); \
(req)->error_len = COMPILE_STRLEN( CONF_MSG_RET_ ## code ); \
(req)->error_line = CONF_LINE_RET_ ## code ; \
(req)->error_msg = CONF_MSG_RET_ ## code ; \
} while (0)
#define HTTPD_ERR_MSG(req, code, xmsg) do { \
(req)->error_xmsg = xmsg; \
HTTPD_ERR(req, code); \
} while (0)
#define HTTPD_ERR_RET(req, code, val) do { \
HTTPD_ERR(req, code); \
return val ; \
} while (0)
#define HTTPD_ERR_MSG_RET(req, code, xmsg, val) do { \
(req)->error_xmsg = xmsg; \
HTTPD_ERR(req, code); \
return val ; \
} while (0)
#define HTTPD_ERR_REDIR(x) \
(((x) == 301) || \
((x) == 302) || \
((x) == 303) || \
((x) == 307))
#define HTTPD_ERR_MATCH_RESP(x) \
(((x) == 400) || \
((x) == 403) || \
((x) == 404) || \
((x) == 406) || \
((x) == 410))
#endif