mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
mod_proxy: follow up to r1836588: configurable Proxy100Continue.
Add Proxy100Continue directive to allow for 100-continue forwarding opt-out. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1856036 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -2128,6 +2128,29 @@ header for proxied requests</description>
|
|||||||
</usage>
|
</usage>
|
||||||
</directivesynopsis>
|
</directivesynopsis>
|
||||||
|
|
||||||
|
<directivesynopsis>
|
||||||
|
<name>Proxy100Continue</name>
|
||||||
|
<description>Forward 100-continue expectation to the origin server</description>
|
||||||
|
<syntax>Proxy100Continue Off|On</syntax>
|
||||||
|
<default>Proxy100Continue On</default>
|
||||||
|
<contextlist><context>server config</context>
|
||||||
|
<context>virtual host</context>
|
||||||
|
<context>directory</context>
|
||||||
|
</contextlist>
|
||||||
|
<compatibility>Available in version 2.4.39 and later</compatibility>
|
||||||
|
|
||||||
|
<usage>
|
||||||
|
<p>This directive determines whether the proxy should forward 100-continue
|
||||||
|
<em>Expect:</em>ation to the origin server and thus let it decide when/if
|
||||||
|
the HTTP request body should be read, or when <code>Off</code> the proxy
|
||||||
|
should generate <em>100 Continue</em> intermediate response by itself before
|
||||||
|
forwarding the request body.</p>
|
||||||
|
<note><title>Effectiveness</title>
|
||||||
|
<p>This option is of use only for HTTP proxying, as handled by <module>mod_proxy_http</module>.</p>
|
||||||
|
</note>
|
||||||
|
</usage>
|
||||||
|
</directivesynopsis>
|
||||||
|
|
||||||
<directivesynopsis>
|
<directivesynopsis>
|
||||||
<name>ProxySourceAddress</name>
|
<name>ProxySourceAddress</name>
|
||||||
<description>Set local IP address for outgoing proxy connections</description>
|
<description>Set local IP address for outgoing proxy connections</description>
|
||||||
|
@@ -612,6 +612,7 @@
|
|||||||
* 20191203.1 (2.5.1-dev) Axe bucket number from struct process_score
|
* 20191203.1 (2.5.1-dev) Axe bucket number from struct process_score
|
||||||
* 20191203.2 (2.5.1-dev) Add ap_no2slash_ex() and merge_slashes to
|
* 20191203.2 (2.5.1-dev) Add ap_no2slash_ex() and merge_slashes to
|
||||||
* core_server_conf.
|
* core_server_conf.
|
||||||
|
* 20191203.3 (2.5.1-dev) Add forward_100_continue{,_set} to proxy_dir_conf
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
|
#define MODULE_MAGIC_COOKIE 0x41503235UL /* "AP25" */
|
||||||
@@ -619,7 +620,7 @@
|
|||||||
#ifndef MODULE_MAGIC_NUMBER_MAJOR
|
#ifndef MODULE_MAGIC_NUMBER_MAJOR
|
||||||
#define MODULE_MAGIC_NUMBER_MAJOR 20191203
|
#define MODULE_MAGIC_NUMBER_MAJOR 20191203
|
||||||
#endif
|
#endif
|
||||||
#define MODULE_MAGIC_NUMBER_MINOR 2 /* 0...n */
|
#define MODULE_MAGIC_NUMBER_MINOR 3 /* 0...n */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
|
* Determine if the server's current MODULE_MAGIC_NUMBER is at least a
|
||||||
|
@@ -1579,6 +1579,8 @@ static void *create_proxy_dir_config(apr_pool_t *p, char *dummy)
|
|||||||
new->error_override_set = 0;
|
new->error_override_set = 0;
|
||||||
new->add_forwarded_headers = 1;
|
new->add_forwarded_headers = 1;
|
||||||
new->add_forwarded_headers_set = 0;
|
new->add_forwarded_headers_set = 0;
|
||||||
|
new->forward_100_continue = 1;
|
||||||
|
new->forward_100_continue_set = 0;
|
||||||
|
|
||||||
return (void *) new;
|
return (void *) new;
|
||||||
}
|
}
|
||||||
@@ -1615,6 +1617,11 @@ static void *merge_proxy_dir_config(apr_pool_t *p, void *basev, void *addv)
|
|||||||
: add->add_forwarded_headers;
|
: add->add_forwarded_headers;
|
||||||
new->add_forwarded_headers_set = add->add_forwarded_headers_set
|
new->add_forwarded_headers_set = add->add_forwarded_headers_set
|
||||||
|| base->add_forwarded_headers_set;
|
|| base->add_forwarded_headers_set;
|
||||||
|
new->forward_100_continue =
|
||||||
|
(add->forward_100_continue_set == 0) ? base->forward_100_continue
|
||||||
|
: add->forward_100_continue;
|
||||||
|
new->forward_100_continue_set = add->forward_100_continue_set
|
||||||
|
|| base->forward_100_continue_set;
|
||||||
|
|
||||||
return new;
|
return new;
|
||||||
}
|
}
|
||||||
@@ -2130,6 +2137,14 @@ static const char *
|
|||||||
conf->preserve_host_set = 1;
|
conf->preserve_host_set = 1;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
static const char *
|
||||||
|
forward_100_continue(cmd_parms *parms, void *dconf, int flag)
|
||||||
|
{
|
||||||
|
proxy_dir_conf *conf = dconf;
|
||||||
|
conf->forward_100_continue = flag;
|
||||||
|
conf->forward_100_continue_set = 1;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
set_recv_buffer_size(cmd_parms *parms, void *dummy, const char *arg)
|
set_recv_buffer_size(cmd_parms *parms, void *dummy, const char *arg)
|
||||||
@@ -2717,6 +2732,9 @@ static const command_rec proxy_cmds[] =
|
|||||||
"Configure local source IP used for request forward"),
|
"Configure local source IP used for request forward"),
|
||||||
AP_INIT_FLAG("ProxyAddHeaders", add_proxy_http_headers, NULL, RSRC_CONF|ACCESS_CONF,
|
AP_INIT_FLAG("ProxyAddHeaders", add_proxy_http_headers, NULL, RSRC_CONF|ACCESS_CONF,
|
||||||
"on if X-Forwarded-* headers should be added or completed"),
|
"on if X-Forwarded-* headers should be added or completed"),
|
||||||
|
AP_INIT_FLAG("Proxy100Continue", forward_100_continue, NULL, RSRC_CONF|ACCESS_CONF,
|
||||||
|
"on if 100-Continue should be forwarded to the origin server, off if the "
|
||||||
|
"proxy should handle it by itself"),
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -240,6 +240,8 @@ typedef struct {
|
|||||||
/** Named back references */
|
/** Named back references */
|
||||||
apr_array_header_t *refs;
|
apr_array_header_t *refs;
|
||||||
|
|
||||||
|
unsigned int forward_100_continue:1;
|
||||||
|
unsigned int forward_100_continue_set:1;
|
||||||
} proxy_dir_conf;
|
} proxy_dir_conf;
|
||||||
|
|
||||||
/* if we interpolate env vars per-request, we'll need a per-request
|
/* if we interpolate env vars per-request, we'll need a per-request
|
||||||
|
@@ -1947,6 +1947,7 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
|
|||||||
proxy_conn_rec *backend = NULL;
|
proxy_conn_rec *backend = NULL;
|
||||||
int is_ssl = 0;
|
int is_ssl = 0;
|
||||||
conn_rec *c = r->connection;
|
conn_rec *c = r->connection;
|
||||||
|
proxy_dir_conf *dconf;
|
||||||
int retry = 0;
|
int retry = 0;
|
||||||
char *locurl = url;
|
char *locurl = url;
|
||||||
int toclose = 0;
|
int toclose = 0;
|
||||||
@@ -2007,8 +2008,11 @@ static int proxy_http_handler(request_rec *r, proxy_worker *worker,
|
|||||||
req->bucket_alloc = c->bucket_alloc;
|
req->bucket_alloc = c->bucket_alloc;
|
||||||
req->rb_method = RB_INIT;
|
req->rb_method = RB_INIT;
|
||||||
|
|
||||||
|
dconf = ap_get_module_config(r->per_dir_config, &proxy_module);
|
||||||
|
|
||||||
/* Should we handle end-to-end or ping 100-continue? */
|
/* Should we handle end-to-end or ping 100-continue? */
|
||||||
if (r->expecting_100 || PROXY_DO_100_CONTINUE(worker, r)) {
|
if ((r->expecting_100 && dconf->forward_100_continue)
|
||||||
|
|| PROXY_DO_100_CONTINUE(worker, r)) {
|
||||||
/* We need to reset r->expecting_100 or prefetching will cause
|
/* We need to reset r->expecting_100 or prefetching will cause
|
||||||
* ap_http_filter() to send "100 Continue" response by itself. So
|
* ap_http_filter() to send "100 Continue" response by itself. So
|
||||||
* we'll use req->expecting_100 in mod_proxy_http to determine whether
|
* we'll use req->expecting_100 in mod_proxy_http to determine whether
|
||||||
|
Reference in New Issue
Block a user