]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1903744, r1903745, r1904642, r1905646, r1905669 from trunk:
authorEric Covener <covener@apache.org>
Mon, 9 Jan 2023 13:26:52 +0000 (13:26 +0000)
committerEric Covener <covener@apache.org>
Mon, 9 Jan 2023 13:26:52 +0000 (13:26 +0000)
    Allow for HTTP/1.1 or HTTP/1.0 protocol health checks

    Document hcmethod enhancement to allow HTTP/1.1 comms

    catch by CJ

    Bump mmn

    bump again

+ suppress MMN changes, applied manually in 1906496

Submitted By: jim
Reviewed By: jim, covener, rpluem

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1906498 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
docs/manual/mod/mod_proxy_hcheck.xml
modules/proxy/mod_proxy.c
modules/proxy/mod_proxy.h
modules/proxy/mod_proxy_hcheck.c

diff --git a/CHANGES b/CHANGES
index 0e6c15ef4f2aa1eecf2ce4cb7af753c5088bb86a..a37e62414a4d856fbe1753c725520dbb012a29d0 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.55
 
+  *) mod_proxy_hcheck: hcmethod now allows for HTTP/1.1 requests
+     using GET11, HEAD11 and/or OPTIONS11. [Jim Jagielski]
+
   *) mod_proxy: The AH03408 warning for a forcibly closed backend
      connection is now logged at INFO level.  [Yann Ylavic]
 
diff --git a/STATUS b/STATUS
index 0ecc64966abaeb8c58157da58976c5fa19bac7f5..555776edace988e4f4d921dad3a7e5e60a46e132 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -149,17 +149,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mod_proxy_hcheck: hcmethod now allow for HTTP/1.1 requests
-     using GET11, HEAD11 and/or OPTIONS11.
-     trunk revision:
-        https://svn.apache.org/r1903744
-        https://svn.apache.org/r1903745
-        https://svn.apache.org/r1904642
-        https://svn.apache.org/r1905646/1905669. (*)
-     Backport version for 2.4.x of patch:
-        svn merge works  (* requires hand fixing)
-     +1: jim, covener, rpluem
-
   *) mod_dav: DAVlockDiscovery option to disable WebDAV lock discovery
      This is a game changer for performances if client use PROPFIND a lot,
      trunk patch: http://svn.apache.org/r1904638
index 5ac2bf66b2287959a82d25729b58606bfbc33111..4c1c8de931d1247a94bb4d0bcf87a4e463cf09be 100644 (file)
                        <tr><th>Method</th><th>Description</th><th>Note</th></tr>
                        <tr><td>None</td><td>No dynamic health checking done</td><td></td></tr>
                        <tr><td>TCP</td><td>Check that a socket to the backend can be created: e.g. "are you up"</td><td></td></tr>
-                       <tr><td>OPTIONS</td><td>Send an <code>HTTP OPTIONS</code> request to the backend</td><td>*</td></tr>
-                       <tr><td>HEAD</td><td>Send an <code>HTTP HEAD</code> request to the backend</td><td>*</td></tr>
-                       <tr><td>GET</td><td>Send an <code>HTTP GET</code> request to the backend</td><td>*</td></tr>
+                       <tr><td>OPTIONS</td><td>Send a <code>HTTP OPTIONS</code> request to the backend via <code>HTTP/1.0</code></td><td>*</td></tr>
+                       <tr><td>HEAD</td><td>Send a <code>HTTP HEAD</code> request to the backend via <code>HTTP/1.0</code></td><td>*</td></tr>
+                       <tr><td>GET</td><td>Send a <code>HTTP GET</code> request to the backend via <code>HTTP/1.0</code></td><td>*</td></tr>
+                       <tr><td>OPTIONS11</td><td>Send a <code>HTTP OPTIONS</code> request to the backend via <code>HTTP/1.1</code></td><td>*</td></tr>
+                       <tr><td>HEAD11</td><td>Send a <code>HTTP HEAD</code> request to the backend via <code>HTTP/1.1</code></td><td>*</td></tr>
+                       <tr><td>GET11</td><td>Send a <code>HTTP GET</code> request to the backend via <code>HTTP/1.1</code></td><td>*</td></tr>
 <!--
                        <tr><td>CPING</td><td><strong>AJP only</strong> Do <code>CPING/CPONG</code> check</td><td></td></tr>
                        <tr><td>PROVIDER</td><td>Name of <code>provider</code> to be used to check health</td><td></td></tr>
index faab18c02413d8150be6cd4a0ca125e390c53d56..9225bc9be5804a7cd461a32d37a8ab269ef3a737 100644 (file)
@@ -52,6 +52,9 @@ proxy_hcmethods_t PROXY_DECLARE_DATA proxy_hcmethods[] = {
     {GET, "GET", 1},
     {CPING, "CPING", 0},
     {PROVIDER, "PROVIDER", 0},
+    {OPTIONS11, "OPTIONS11", 1},
+    {HEAD11, "HEAD11", 1},
+    {GET11, "GET11", 1},
     {EOT, NULL, 1}
 };
 
index 6a5fe6d0b0f5ee1e51fc66f2a3112acc55430947..5c08e99c9e6baf618c4d7e9a09bd3c614bd6f473 100644 (file)
@@ -77,7 +77,7 @@ enum enctype {
 };
 
 typedef enum {
-    NONE, TCP, OPTIONS, HEAD, GET, CPING, PROVIDER, EOT
+    NONE, TCP, OPTIONS, HEAD, GET, CPING, PROVIDER, OPTIONS11, HEAD11, GET11, EOT
 } hcmethod_t;
 
 typedef struct {
index 33dc6dea03225962fc440dc44e2ec710c97ca185..753a709d95e6c32fb9993dccb1412bec8aede83c 100644 (file)
@@ -65,6 +65,7 @@ typedef struct {
     const char *method; /* Method string for the HTTP/AJP request */
     const char *req;    /* pre-formatted HTTP/AJP request */
     proxy_worker *w;    /* Pointer to the actual worker */
+    const char *protocol; /* HTTP 1.0 or 1.1? */
 } wctx_t;
 
 typedef struct {
@@ -342,7 +343,8 @@ static const char *set_hc_tpsize (cmd_parms *cmd, void *dummy, const char *arg)
  */
 static request_rec *create_request_rec(apr_pool_t *p, server_rec *s,
                                        proxy_balancer *balancer,
-                                       const char *method)
+                                       const char *method,
+                                       const char *protocol)
 {
     request_rec *r;
 
@@ -400,10 +402,12 @@ static request_rec *create_request_rec(apr_pool_t *p, server_rec *s,
     else {
         r->header_only = 0;
     }
-
     r->protocol = "HTTP/1.0";
     r->proto_num = HTTP_VERSION(1, 0);
-
+    if ( protocol && (protocol[7] == '1') ) {
+        r->protocol = "HTTP/1.1";
+        r->proto_num = HTTP_VERSION(1, 1);
+    }
     r->hostname = NULL;
 
     return r;
@@ -427,31 +431,43 @@ static void create_hcheck_req(wctx_t *wctx, proxy_worker *hc,
 {
     char *req = NULL;
     const char *method = NULL;
+    const char *protocol = NULL;
+
+    /* TODO: Fold into switch/case below? This seems more obvious */
+    if ( (hc->s->method == OPTIONS11) || (hc->s->method == HEAD11) || (hc->s->method == GET11) ) {
+        protocol = "HTTP/1.1";
+    } else {
+        protocol = "HTTP/1.0";
+    }
     switch (hc->s->method) {
         case OPTIONS:
+        case OPTIONS11:
             method = "OPTIONS";
             req = apr_psprintf(p,
-                               "OPTIONS * HTTP/1.0\r\n"
+                               "OPTIONS * %s\r\n"
                                "Host: %s:%d\r\n"
-                               "\r\n",
+                               "\r\n", protocol,
                                hc->s->hostname_ex, (int)hc->s->port);
             break;
 
         case HEAD:
+        case HEAD11:
             method = "HEAD";
             /* fallthru */
         case GET:
+        case GET11:
             if (!method) { /* did we fall thru? If not, we are GET */
                 method = "GET";
             }
             req = apr_psprintf(p,
-                               "%s %s%s%s HTTP/1.0\r\n"
+                               "%s %s%s%s %s\r\n"
                                "Host: %s:%d\r\n"
                                "\r\n",
                                method,
                                (wctx->path ? wctx->path : ""),
                                (wctx->path && *hc->s->hcuri ? "/" : "" ),
                                (*hc->s->hcuri ? hc->s->hcuri : ""),
+                               protocol,
                                hc->s->hostname_ex, (int)hc->s->port);
             break;
 
@@ -460,6 +476,7 @@ static void create_hcheck_req(wctx_t *wctx, proxy_worker *hc,
     }
     wctx->req = req;
     wctx->method = method;
+    wctx->protocol = protocol;
 }
 
 static proxy_worker *hc_get_hcworker(sctx_t *ctx, proxy_worker *worker,
@@ -640,7 +657,7 @@ static apr_status_t hc_check_cping(baton_t *baton, apr_thread_t *thread)
     if ((status = ap_proxy_connect_backend("HCCPING", backend, hc, ctx->s)) != OK) {
         return backend_cleanup("HCCPING", backend, ctx->s, status);
     }
-    r = create_request_rec(ptemp, ctx->s, baton->balancer, "CPING");
+    r = create_request_rec(ptemp, ctx->s, baton->balancer, "CPING", NULL);
     if ((status = ap_proxy_connection_create_ex("HCCPING", backend, r)) != OK) {
         return backend_cleanup("HCCPING", backend, ctx->s, status);
     }
@@ -827,7 +844,7 @@ static apr_status_t hc_check_http(baton_t *baton, apr_thread_t *thread)
         return backend_cleanup("HCOH", backend, ctx->s, status);
     }
 
-    r = create_request_rec(ptemp, ctx->s, baton->balancer, wctx->method);
+    r = create_request_rec(ptemp, ctx->s, baton->balancer, wctx->method, wctx->protocol);
     if ((status = ap_proxy_connection_create_ex("HCOH", backend, r)) != OK) {
         return backend_cleanup("HCOH", backend, ctx->s, status);
     }