MINOR: http: Mark the 425 code as "Too Early".

This adds a new status code for use with the "http-request deny" ruleset.
The use case for this code is currently handled by this draft dedicated
to 0-RTT processing :

   https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-replay
This commit is contained in:
Olivier Houchard 2017-10-02 16:12:07 +02:00 committed by Willy Tarreau
parent 31904278dc
commit 51a76d84e4
3 changed files with 18 additions and 7 deletions

View File

@ -3154,8 +3154,8 @@ errorfile <code> <file>
yes | yes | yes | yes
Arguments :
<code> is the HTTP status code. Currently, HAProxy is capable of
generating codes 200, 400, 403, 405, 408, 429, 500, 502, 503, and
504.
generating codes 200, 400, 403, 405, 408, 425, 429, 500, 502,
503, and 504.
<file> designates a file containing the full HTTP response. It is
recommended to follow the common practice of appending ".http" to
@ -3203,8 +3203,8 @@ errorloc302 <code> <url>
yes | yes | yes | yes
Arguments :
<code> is the HTTP status code. Currently, HAProxy is capable of
generating codes 200, 400, 403, 405, 408, 429, 500, 502, 503, and
504.
generating codes 200, 400, 403, 405, 408, 425, 429, 500, 502,
503, and 504.
<url> it is the exact contents of the "Location" header. It may contain
either a relative URI to an error page hosted on the same site,
@ -3235,8 +3235,8 @@ errorloc303 <code> <url>
yes | yes | yes | yes
Arguments :
<code> is the HTTP status code. Currently, HAProxy is capable of
generating codes 200, 400, 403, 405, 408, 429, 500, 502, 503, and
504.
generating codes 200, 400, 403, 405, 408, 425, 429, 500, 502,
503, and 504.
<url> it is the exact contents of the "Location" header. It may contain
either a relative URI to an error page hosted on the same site,

View File

@ -196,6 +196,7 @@ enum {
HTTP_ERR_403,
HTTP_ERR_405,
HTTP_ERR_408,
HTTP_ERR_425,
HTTP_ERR_429,
HTTP_ERR_500,
HTTP_ERR_502,

View File

@ -140,6 +140,7 @@ const int http_err_codes[HTTP_ERR_SIZE] = {
[HTTP_ERR_403] = 403,
[HTTP_ERR_405] = 405,
[HTTP_ERR_408] = 408,
[HTTP_ERR_425] = 425,
[HTTP_ERR_429] = 429,
[HTTP_ERR_500] = 500,
[HTTP_ERR_502] = 502,
@ -188,6 +189,14 @@ static const char *http_err_msgs[HTTP_ERR_SIZE] = {
"\r\n"
"<html><body><h1>408 Request Time-out</h1>\nYour browser didn't send a complete request in time.\n</body></html>\n",
[HTTP_ERR_425] =
"HTTP/1.0 425 Too Early\r\n"
"Cache-Control: no-cache\r\n"
"Connection: close\r\n"
"Content-Type: text/html\r\n"
"\r\n"
"<html><body><h1>425 Too Early</h1>\nYour browser sent early data.\n</body></html>\n",
[HTTP_ERR_429] =
"HTTP/1.0 429 Too Many Requests\r\n"
"Cache-Control: no-cache\r\n"
@ -332,7 +341,7 @@ const char *get_reason(unsigned int status)
case 422: return "Unprocessable entity";
case 423: return "Locked";
case 424: return "Method failure";
case 425: return "Unordered Collection";
case 425: return "Too Early";
case 426: return "Upgrade Required";
case 428: return "Precondition Required";
case 429: return "Too Many Requests";
@ -378,6 +387,7 @@ static const int http_get_status_idx(unsigned int status)
case 403: return HTTP_ERR_403;
case 405: return HTTP_ERR_405;
case 408: return HTTP_ERR_408;
case 425: return HTTP_ERR_425;
case 429: return HTTP_ERR_429;
case 500: return HTTP_ERR_500;
case 502: return HTTP_ERR_502;