]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_proxy_http: Follow up to r1901420: consistent 100-continue checks.
authorYann Ylavic <ylavic@apache.org>
Tue, 31 May 2022 11:05:41 +0000 (11:05 +0000)
committerYann Ylavic <ylavic@apache.org>
Tue, 31 May 2022 11:05:41 +0000 (11:05 +0000)
Let proxy_http_handler() tell ap_proxy_create_hdrbrgd() whether to add or
preserve Expect header or not, through the "proxy-100-continue" note.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1901446 13f79535-47bb-0310-9956-ffa450edef68

modules/proxy/mod_proxy_http.c
modules/proxy/proxy_util.c

index c0b20c2462dec5c0fb915d7a88a65b7638926128..1323e2749647ffd8b8d347438ccb2f4857da87d0 100644 (file)
@@ -2007,6 +2007,8 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
     if (!req->force10
         && ((r->expecting_100 && (dconf->forward_100_continue || input_brigade))
             || PROXY_SHOULD_PING_100_CONTINUE(worker, r))) {
+        /* Tell ap_proxy_create_hdrbrgd() to preserve/add the Expect header */
+        apr_table_setn(r->notes, "proxy-100-continue", "1");
         req->do_100_continue = 1;
     }
 
index c0c6b994864635f3b692314e8e8ef08e230740e2..f83c2c5093143501afcead6e74106f17dbadc206 100644 (file)
@@ -3891,7 +3891,7 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
     char *buf;
     apr_table_t *saved_headers_in, *request_headers;
     apr_bucket *e;
-    int force10 = 0, ping100 = 0;
+    int force10 = 0, do_100_continue = 0;
     conn_rec *origin = p_conn->connection;
     const char *creds;
     proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
@@ -3904,8 +3904,9 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
     if (apr_table_get(r->subprocess_env, "force-proxy-request-1.0")) {
         force10 = 1;
     }
-    else if (PROXY_SHOULD_PING_100_CONTINUE(worker, r)) {
-        ping100 = 1;
+    else if (apr_table_get(r->notes, "proxy-100-continue")
+             || PROXY_SHOULD_PING_100_CONTINUE(worker, r)) {
+        do_100_continue = 1;
     }
     if (force10 || apr_table_get(r->subprocess_env, "proxy-nokeepalive")) {
         if (origin) {
@@ -4012,7 +4013,7 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
     /* Use HTTP/1.1 100-Continue as quick "HTTP ping" test
      * to backend
      */
-    if (ping100) {
+    if (do_100_continue) {
         /* Add the Expect header if not already there. */
         const char *val = apr_table_get(request_headers, "Expect");
         if (!val || (ap_cstr_casecmp(val, "100-Continue") != 0 /* fast path */
@@ -4020,7 +4021,10 @@ PROXY_DECLARE(int) ap_proxy_create_hdrbrgd(apr_pool_t *p,
             apr_table_mergen(request_headers, "Expect", "100-Continue");
         }
     }
-    else if (force10 || !dconf->forward_100_continue || !r->expecting_100) {
+    else {
+        /* XXX: we should strip the 100-continue token only from the
+         * Expect header, but are there others actually used anywhere?
+         */
         apr_table_unset(request_headers, "Expect");
     }