]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http: Mark the 425 code as "Too Early".
authorOlivier Houchard <ohouchard@haproxy.com>
Mon, 2 Oct 2017 14:12:07 +0000 (16:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 27 Oct 2017 08:53:32 +0000 (10:53 +0200)
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

doc/configuration.txt
include/types/proto_http.h
src/proto_http.c

index bba695afd83735a83cbc0f731aa5919622568da2..5a8c8b54e82e62e3e2482b3aadd884a18eee33d7 100644 (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,
index 027bfce42f9afadf00d4cb3c1a98cf8dd0a75a1e..cf0fdb698f21f479fdd6793afbd4acb4ca2f73e2 100644 (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,
index c81409f39f03a872041c94a9cc7a0a2ac66ab6cf..939a7a137f786ede31447796ffc39b0bb9a3dc3b 100644 (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;