]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: http: Add support for 421 Misdirected Request
authorTim Duesterhus <tim@bastelstu.be>
Fri, 27 Apr 2018 19:18:46 +0000 (21:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Sat, 28 Apr 2018 05:03:39 +0000 (07:03 +0200)
This makes haproxy aware of HTTP 421 Misdirected Request, which
is defined in RFC 7540, section 9.1.2.

include/types/proto_http.h
src/proto_http.c

index b7b7c6cbc1d789056ffd9379e3cb076b2b71c81c..5a6cc931291d3ad4b9f9b53a3227ce03e1fe8d14 100644 (file)
@@ -197,6 +197,7 @@ enum {
        HTTP_ERR_403,
        HTTP_ERR_405,
        HTTP_ERR_408,
+       HTTP_ERR_421,
        HTTP_ERR_425,
        HTTP_ERR_429,
        HTTP_ERR_500,
index f2a76823a58af7ca279e2b69e500ee1da014fd81..345e889ba6d2139fc7c56e6148517d600f0f87cb 100644 (file)
@@ -142,6 +142,7 @@ const int http_err_codes[HTTP_ERR_SIZE] = {
        [HTTP_ERR_403] = 403,
        [HTTP_ERR_405] = 405,
        [HTTP_ERR_408] = 408,
+       [HTTP_ERR_421] = 421,
        [HTTP_ERR_425] = 425,
        [HTTP_ERR_429] = 429,
        [HTTP_ERR_500] = 500,
@@ -191,6 +192,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_421] =
+       "HTTP/1.0 421 Misdirected Request\r\n"
+       "Cache-Control: no-cache\r\n"
+       "Connection: close\r\n"
+       "Content-Type: text/html\r\n"
+       "\r\n"
+       "<html><body><h1>421 Misdirected Request</h1>\nRequest sent to a non-authoritative server.\n</body></html>\n",
+
        [HTTP_ERR_425] =
        "HTTP/1.0 425 Too Early\r\n"
        "Cache-Control: no-cache\r\n"
@@ -340,6 +349,7 @@ const char *get_reason(unsigned int status)
        case 416: return "Requested range unsatisfiable";
        case 417: return "Expectation failed";
        case 418: return "I'm a teapot";
+       case 421: return "Misdirected Request";
        case 422: return "Unprocessable entity";
        case 423: return "Locked";
        case 424: return "Method failure";
@@ -389,6 +399,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 421: return HTTP_ERR_421;
        case 425: return HTTP_ERR_425;
        case 429: return HTTP_ERR_429;
        case 500: return HTTP_ERR_500;