mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
New directive ProxyIOBufferSize. Sets the size of the buffer used
when reading from a remote HTTP server in proxy. Modify receive/send loop in proxy_http and proxy_ftp so that should it be necessary, the remote server socket is closed before transmitting the last buffer (set by ProxyIOBufferSize) to the client. This prevents the backend server from being forced to hang around while the last few bytes are transmitted to a slow client. Fix the case where no error checking was performed on the final brigade in the loop. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93811 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -489,6 +489,8 @@ static void * create_proxy_config(apr_pool_t *p, server_rec *s)
|
||||
ps->req_set = 0;
|
||||
ps->recv_buffer_size = 0; /* this default was left unset for some reason */
|
||||
ps->recv_buffer_size_set = 0;
|
||||
ps->io_buffer_size = AP_IOBUFSIZE;
|
||||
ps->io_buffer_size_set = 0;
|
||||
ps->maxfwd = DEFAULT_MAX_FORWARDS;
|
||||
ps->maxfwd_set = 0;
|
||||
ps->error_override = 0;
|
||||
@@ -518,6 +520,7 @@ static void * merge_proxy_config(apr_pool_t *p, void *basev, void *overridesv)
|
||||
ps->viaopt = (overrides->viaopt_set == 0) ? base->viaopt : overrides->viaopt;
|
||||
ps->req = (overrides->req_set == 0) ? base->req : overrides->req;
|
||||
ps->recv_buffer_size = (overrides->recv_buffer_size_set == 0) ? base->recv_buffer_size : overrides->recv_buffer_size;
|
||||
ps->io_buffer_size = (overrides->io_buffer_size_set == 0) ? base->io_buffer_size : overrides->io_buffer_size;
|
||||
ps->maxfwd = (overrides->maxfwd_set == 0) ? base->maxfwd : overrides->maxfwd;
|
||||
ps->error_override = (overrides->error_override_set == 0) ? base->error_override : overrides->error_override;
|
||||
ps->preserve_host = (overrides->preserve_host_set == 0) ? base->preserve_host : overrides->preserve_host;
|
||||
@@ -841,6 +844,18 @@ static const char *
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
set_io_buffer_size(cmd_parms *parms, void *dummy, const char *arg)
|
||||
{
|
||||
proxy_server_conf *psf =
|
||||
ap_get_module_config(parms->server->module_config, &proxy_module);
|
||||
long s = atol(arg);
|
||||
|
||||
psf->io_buffer_size = MAX(s, AP_IOBUFSIZE);
|
||||
psf->io_buffer_size_set = 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
set_max_forwards(cmd_parms *parms, void *dummy, const char *arg)
|
||||
{
|
||||
@@ -1004,6 +1019,8 @@ static const command_rec proxy_cmds[] =
|
||||
"A list of names, hosts or domains to which the proxy will not connect"),
|
||||
AP_INIT_TAKE1("ProxyReceiveBufferSize", set_recv_buffer_size, NULL, RSRC_CONF,
|
||||
"Receive buffer size for outgoing HTTP and FTP connections in bytes"),
|
||||
AP_INIT_TAKE1("ProxyIOBufferSize", set_io_buffer_size, NULL, RSRC_CONF,
|
||||
"IO buffer size for outgoing HTTP and FTP connections in bytes"),
|
||||
AP_INIT_TAKE1("ProxyMaxForwards", set_max_forwards, NULL, RSRC_CONF,
|
||||
"The maximum number of proxies a request may be forwarded through."),
|
||||
AP_INIT_ITERATE("NoProxy", set_proxy_dirconn, NULL, RSRC_CONF,
|
||||
|
Reference in New Issue
Block a user