diff options
author | Yann Ylavic <ylavic@apache.org> | 2022-05-31 11:05:41 +0000 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2022-05-31 11:05:41 +0000 |
commit | d161bb4cc2932e3101b2a3e36d6390bb6199e19d (patch) | |
tree | fdd13d876310b85837cadd7664c56a961b278438 /modules/proxy | |
parent | 9a8214d08fac52dda13ecc673ade2f5152f8e9de (diff) | |
download | httpd-d161bb4cc2932e3101b2a3e36d6390bb6199e19d.tar.gz |
mod_proxy_http: Follow up to r1901420: consistent 100-continue checks.
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
Diffstat (limited to 'modules/proxy')
-rw-r--r-- | modules/proxy/mod_proxy_http.c | 2 | ||||
-rw-r--r-- | modules/proxy/proxy_util.c | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/modules/proxy/mod_proxy_http.c b/modules/proxy/mod_proxy_http.c index c0b20c2462..1323e27496 100644 --- a/modules/proxy/mod_proxy_http.c +++ b/modules/proxy/mod_proxy_http.c @@ -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; } diff --git a/modules/proxy/proxy_util.c b/modules/proxy/proxy_util.c index c0c6b99486..f83c2c5093 100644 --- a/modules/proxy/proxy_util.c +++ b/modules/proxy/proxy_util.c @@ -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"); } |