From c1d3eb8299aa57307988e609d6b95f5cee32470e Mon Sep 17 00:00:00 2001 From: Graham Leggett Date: Sat, 9 Mar 2002 22:25:41 +0000 Subject: [PATCH] Add the ProxyIOBufferSize option. Previously the size of the buffer used while reading from the remote server in proxy was taken from ProxyReceiveBufferSize. These two functions were similar but not the same, thus the need for the split. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@93821 13f79535-47bb-0310-9956-ffa450edef68 --- src/CHANGES | 4 ++++ src/modules/proxy/mod_proxy.c | 17 +++++++++++++++++ src/modules/proxy/mod_proxy.h | 2 ++ src/modules/proxy/proxy_ftp.c | 2 +- src/modules/proxy/proxy_http.c | 2 +- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/CHANGES b/src/CHANGES index e7275d5f763..ca77fe4084d 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -1,5 +1,9 @@ Changes with Apache 1.3.24 + *) Add the ProxyIOBufferSize option. Previously the size of the + buffer used while reading from the remote server in proxy was + taken from ProxyReceiveBufferSize. [Graham Leggett] + *) Fix a NULL variable check in proxy where we were checking the wrong variable. [Geff Hanoian ] diff --git a/src/modules/proxy/mod_proxy.c b/src/modules/proxy/mod_proxy.c index eb1fcb1bcd8..4975d72448d 100644 --- a/src/modules/proxy/mod_proxy.c +++ b/src/modules/proxy/mod_proxy.c @@ -424,6 +424,8 @@ static void * 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 = IOBUFSIZE; + ps->io_buffer_size_set = 0; ps->cache.root = NULL; ps->cache.space = DEFAULT_CACHE_SPACE; @@ -467,6 +469,7 @@ static void * 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->cache.root = (overrides->cache.root == NULL) ? base->cache.root : overrides->cache.root; ps->cache.space = (overrides->cache.space_set == 0) ? base->cache.space : overrides->cache.space; @@ -843,6 +846,18 @@ static const char * return NULL; } +static const char * + set_io_buffer_size(cmd_parms *parms, void *dummy, char *arg) +{ + proxy_server_conf *psf = + ap_get_module_config(parms->server->module_config, &proxy_module); + long s = atol(arg); + + psf->io_buffer_size = ((s > IOBUFSIZE) ? s : IOBUFSIZE); + psf->io_buffer_size_set = 1; + return NULL; +} + static const char* set_cache_completion(cmd_parms *parms, void *dummy, char *arg) { @@ -904,6 +919,8 @@ static const command_rec proxy_cmds[] = "A list of names, hosts or domains to which the proxy will not connect"}, {"ProxyReceiveBufferSize", set_recv_buffer_size, NULL, RSRC_CONF, TAKE1, "Receive buffer size for outgoing HTTP and FTP connections in bytes"}, + {"ProxyIOBufferSize", set_io_buffer_size, NULL, RSRC_CONF, TAKE1, + "IO buffer size for outgoing HTTP and FTP connections in bytes"}, {"NoProxy", set_proxy_dirconn, NULL, RSRC_CONF, ITERATE, "A list of domains, hosts, or subnets to which the proxy will connect directly"}, {"ProxyDomain", set_proxy_domain, NULL, RSRC_CONF, TAKE1, diff --git a/src/modules/proxy/mod_proxy.h b/src/modules/proxy/mod_proxy.h index 618b68418ec..20eeee2772e 100644 --- a/src/modules/proxy/mod_proxy.h +++ b/src/modules/proxy/mod_proxy.h @@ -201,6 +201,8 @@ typedef struct { char viaopt_set; size_t recv_buffer_size; char recv_buffer_size_set; + size_t io_buffer_size; + char io_buffer_size_set; } proxy_server_conf; struct hdr_entry { diff --git a/src/modules/proxy/proxy_ftp.c b/src/modules/proxy/proxy_ftp.c index 1eb0b3b9c49..659ee0428fa 100644 --- a/src/modules/proxy/proxy_ftp.c +++ b/src/modules/proxy/proxy_ftp.c @@ -1348,7 +1348,7 @@ int ap_proxy_ftp_handler(request_rec *r, cache_req *c, char *url) /* we need to set this for ap_proxy_send_fb()... */ if (c != NULL) c->cache_completion = 0; - ap_proxy_send_fb(data, r, c, -1, 0, conf->recv_buffer_size); + ap_proxy_send_fb(data, r, c, -1, 0, conf->io_buffer_size); } else { send_dir(data, r, c, cwd); diff --git a/src/modules/proxy/proxy_http.c b/src/modules/proxy/proxy_http.c index 0e3e9651371..ac411419b0e 100644 --- a/src/modules/proxy/proxy_http.c +++ b/src/modules/proxy/proxy_http.c @@ -582,7 +582,7 @@ int ap_proxy_http_handler(request_rec *r, cache_req *c, char *url, * content length is not known. We need to make 100% sure c->len is always * set correctly before we get here to correctly do keepalive. */ - ap_proxy_send_fb(f, r, c, c->len, 0, conf->recv_buffer_size); + ap_proxy_send_fb(f, r, c, c->len, 0, conf->io_buffer_size); } /* ap_proxy_send_fb() closes the socket f for us */ -- 2.47.2