httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@hyperreal.org
Subject cvs commit: apache-1.3/src/modules/proxy mod_proxy.h mod_proxy.c
Date Mon, 11 Oct 1999 21:33:37 GMT
martin      99/10/11 14:33:37

  Modified:    src      CHANGES
               src/modules/proxy mod_proxy.h mod_proxy.c
  Log:
  Graham submitted a patch which fixes a problem with the proxy
  configuration where globally set configuration options were
  overridden inside virtual hosts.
  Also, ProxyReceiveBufferSize default values were left uninitialised.
  
  Submitted by:	Graham Leggett <minfrin@sharp.fm>
  Reviewed by:	Martin Kraemer
  
  Revision  Changes    Path
  1.1436    +7 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1435
  retrieving revision 1.1436
  diff -u -r1.1435 -r1.1436
  --- CHANGES	1999/09/27 20:38:32	1.1435
  +++ CHANGES	1999/10/11 21:33:30	1.1436
  @@ -1,5 +1,12 @@
   Changes with Apache 1.3.10
   
  +  *) Fix problem with proxy configuration where globally set configuration
  +     options were overridden inside virtual hosts.
  +     [Graham Leggett <minfrin@sharp.fm>]
  +
  +  *) Fix ProxyReceiveBufferSize where default value was left uninitialised.
  +     [Graham Leggett <minfrin@sharp.fm>]
  +
     *) Added a CLF '-' respecting %B to the log format.
        Suggested by Ragnar Kj°rstad [dirkx]
   
  
  
  
  1.44      +11 -0     apache-1.3/src/modules/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/mod_proxy.h,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- mod_proxy.h	1999/02/07 20:48:31	1.43
  +++ mod_proxy.h	1999/10/11 21:33:34	1.44
  @@ -193,13 +193,21 @@
   struct cache_conf {
       const char *root;		/* the location of the cache directory */
       off_t space;			/* Maximum cache size (in 1024 bytes) */
  +    char space_set;
       time_t maxexpire;		/* Maximum time to keep cached files in secs */
  +    char maxexpire_set;
       time_t defaultexpire;	/* default time to keep cached file in secs */
  +    char defaultexpire_set;
       double lmfactor;		/* factor for estimating expires date */
  +    char lmfactor_set;
       time_t gcinterval;		/* garbage collection interval, in seconds */
  +    char gcinterval_set;
       int dirlevels;		/* Number of levels of subdirectories */
  +    char dirlevels_set;
       int dirlength;		/* Length of subdirectory names */
  +    char dirlength_set;
       float cache_completion;	/* Force cache completion after this point */
  +    char cache_completion_set;
   };
   
   typedef struct {
  @@ -213,13 +221,16 @@
       array_header *allowed_connect_ports;
       char *domain;		/* domain name to use in absence of a domain name in the request */
       int req;			/* true if proxy requests are enabled */
  +    char req_set;
       enum {
         via_off,
         via_on,
         via_block,
         via_full
       } viaopt;                   /* how to deal with proxy Via: headers */
  +    char viaopt_set;
       size_t recv_buffer_size;
  +    char recv_buffer_size_set;
   } proxy_server_conf;
   
   struct hdr_entry {
  
  
  
  1.66      +60 -1     apache-1.3/src/modules/proxy/mod_proxy.c
  
  Index: mod_proxy.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/mod_proxy.c,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- mod_proxy.c	1999/03/10 17:42:46	1.65
  +++ mod_proxy.c	1999/10/11 21:33:35	1.66
  @@ -417,22 +417,69 @@
       ps->allowed_connect_ports = ap_make_array(p, 10, sizeof(int));
       ps->domain = NULL;
       ps->viaopt = via_off; /* initially backward compatible with 1.3.1 */
  +    ps->viaopt_set = 0; /* 0 means default */
       ps->req = 0;
  +    ps->req_set = 0;
  +    ps->recv_buffer_size = 0; /* this default was left unset for some reason */
  +    ps->recv_buffer_size_set = 0;
   
       ps->cache.root = NULL;
       ps->cache.space = DEFAULT_CACHE_SPACE;
  +    ps->cache.space_set = 0;
       ps->cache.maxexpire = DEFAULT_CACHE_MAXEXPIRE;
  +    ps->cache.maxexpire_set = 0;
       ps->cache.defaultexpire = DEFAULT_CACHE_EXPIRE;
  +    ps->cache.defaultexpire_set = 0;
       ps->cache.lmfactor = DEFAULT_CACHE_LMFACTOR;
  +    ps->cache.lmfactor_set = 0;
       ps->cache.gcinterval = -1;
  +    ps->cache.gcinterval_set = 0;
       /* at these levels, the cache can have 2^18 directories (256,000)  */
       ps->cache.dirlevels = 3;
  +    ps->cache.dirlevels_set = 0;
       ps->cache.dirlength = 1;
  +    ps->cache.dirlength_set = 0;
       ps->cache.cache_completion = DEFAULT_CACHE_COMPLETION;
  +    ps->cache.cache_completion_set = 0;
   
       return ps;
   }
   
  +static void *
  +     merge_proxy_config(pool *p, void *basev,
  +                        void *overridesv)
  +{
  +    proxy_server_conf *ps = ap_pcalloc(p, sizeof(proxy_server_conf));
  +    proxy_server_conf *base = (proxy_server_conf *) basev;
  +    proxy_server_conf *overrides = (proxy_server_conf *) overridesv;
  +
  +    ps->proxies = ap_append_arrays(p, base->proxies, overrides->proxies);
  +    ps->aliases = ap_append_arrays(p, base->aliases, overrides->aliases);
  +    ps->raliases = ap_append_arrays(p, base->raliases, overrides->raliases);
  +    ps->noproxies = ap_append_arrays(p, base->noproxies, overrides->noproxies);
  +    ps->dirconn = ap_append_arrays(p, base->dirconn, overrides->dirconn);
  +    ps->nocaches = ap_append_arrays(p, base->nocaches, overrides->nocaches);
  +    ps->allowed_connect_ports = ap_append_arrays(p, base->allowed_connect_ports,
overrides->allowed_connect_ports);
  +
  +    ps->domain = (overrides->domain == NULL) ? base->domain : overrides->domain;
  +    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->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;
  +    ps->cache.maxexpire = (overrides->cache.maxexpire_set == 0) ? base->cache.maxexpire
: overrides->cache.maxexpire;
  +    ps->cache.defaultexpire = (overrides->cache.defaultexpire_set == 0) ? base->cache.defaultexpire
: overrides->cache.defaultexpire;
  +    ps->cache.lmfactor = (overrides->cache.lmfactor_set == 0) ? base->cache.lmfactor
: overrides->cache.lmfactor;
  +    ps->cache.gcinterval = (overrides->cache.gcinterval_set == 0) ? base->cache.gcinterval
: overrides->cache.gcinterval;
  +    /* at these levels, the cache can have 2^18 directories (256,000)  */
  +    ps->cache.dirlevels = (overrides->cache.dirlevels_set == 0) ? base->cache.dirlevels
: overrides->cache.dirlevels;
  +    ps->cache.dirlength = (overrides->cache.dirlength_set == 0) ? base->cache.dirlength
: overrides->cache.dirlength;
  +    ps->cache.cache_completion = (overrides->cache.cache_completion_set == 0) ? base->cache.cache_completion
: overrides->cache.cache_completion;
  +
  +    return ps;
  +}
  +
   static const char *
        add_proxy(cmd_parms *cmd, void *dummy, char *f, char *r)
   {
  @@ -627,6 +674,7 @@
       ap_get_module_config(parms->server->module_config, &proxy_module);
   
       psf->req = flag;
  +    psf->req_set = 1;
       return NULL;
   }
   
  @@ -641,6 +689,7 @@
       if (sscanf(arg, "%d", &val) != 1)
   	return "CacheSize value must be an integer (kBytes)";
       psf->cache.space = val;
  +    psf->cache.space_set = 1;
       return NULL;
   }
   
  @@ -665,6 +714,7 @@
       if (sscanf(arg, "%lg", &val) != 1)
   	return "CacheLastModifiedFactor value must be a float";
       psf->cache.lmfactor = val;
  +    psf->cache.lmfactor_set = 1;
   
       return NULL;
   }
  @@ -679,6 +729,7 @@
       if (sscanf(arg, "%lg", &val) != 1)
   	return "CacheMaxExpire value must be a float";
       psf->cache.maxexpire = (int) (val * (double) SEC_ONE_HR);
  +    psf->cache.maxexpire_set = 1;
       return NULL;
   }
   
  @@ -692,6 +743,7 @@
       if (sscanf(arg, "%lg", &val) != 1)
   	return "CacheDefaultExpire value must be a float";
       psf->cache.defaultexpire = (int) (val * (double) SEC_ONE_HR);
  +    psf->cache.defaultexpire_set = 1;
       return NULL;
   }
   
  @@ -705,6 +757,7 @@
       if (sscanf(arg, "%lg", &val) != 1)
   	return "CacheGcInterval value must be a float";
       psf->cache.gcinterval = (int) (val * (double) SEC_ONE_HR);
  +    psf->cache.gcinterval_set = 1;
       return NULL;
   }
   
  @@ -721,6 +774,7 @@
       if (val * psf->cache.dirlength > CACHEFILE_LEN)
   	return "CacheDirLevels*CacheDirLength value must not be higher than 20";
       psf->cache.dirlevels = val;
  +    psf->cache.dirlevels_set = 1;
       return NULL;
   }
   
  @@ -737,6 +791,7 @@
       if (val * psf->cache.dirlevels > CACHEFILE_LEN)
   	return "CacheDirLevels*CacheDirLength value must not be higher than 20";
       psf->cache.dirlength = val;
  +    psf->cache.dirlength_set = 1;
       return NULL;
   }
   
  @@ -782,6 +837,7 @@
       }
   
       psf->recv_buffer_size = s;
  +    psf->recv_buffer_size_set = 1;
       return NULL;
   }
   
  @@ -798,6 +854,8 @@
   
       if (s > 0)
         psf->cache.cache_completion = ((float)s / 100);
  +
  +    psf->cache.cache_completion = 1;
       return NULL;    
   }
   
  @@ -820,6 +878,7 @@
                  "off | on | full | block";
       }
   
  +    psf->viaopt_set = 1;
       return NULL;    
   }
   
  @@ -881,7 +940,7 @@
       NULL,			/* create per-directory config structure */
       NULL,			/* merge per-directory config structures */
       create_proxy_config,	/* create per-server config structure */
  -    NULL,			/* merge per-server config structures */
  +    merge_proxy_config,		/* merge per-server config structures */
       proxy_cmds,			/* command table */
       proxy_handlers,		/* handlers */
       proxy_trans,		/* translate_handler */
  
  
  

Mime
View raw message