cvs commit: apachen/src/modules/proxy proxy_cache.c

1998-01-24 Thread dgaudet
dgaudet 98/01/24 12:43:44

  Modified:src/modules/proxy proxy_cache.c
  Log:
  When deleting a value from a table, use table_unset() not table_set(key,NULL).
  
  The proxy has all of its own table manipulation routines... like it has
  struct hdr_entry, and proxy_get_header() and all this crap.  But it was
  mixing the use of the real table routines and its own routines.  Clean
  this up.  (Ultimately someone should clean it up to use the real table
  routines, I can't see why it doesn't.)
  
  Revision  ChangesPath
  1.33  +7 -5  apachen/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- proxy_cache.c 1998/01/07 16:46:36 1.32
  +++ proxy_cache.c 1998/01/24 20:43:43 1.33
  @@ -476,7 +476,7 @@
   int proxy_cache_check(request_rec *r, char *url, struct cache_conf *conf,
  struct cache_req **cr)
   {
  -char hashfile[66], *imstr, *pragma, *p, *auth;
  +char hashfile[66], *imstr, *pragma, *auth;
   struct cache_req *c;
   time_t now;
   BUFF *cachefp;
  @@ -499,7 +499,7 @@
imstr = proxy_date_canon(r-pool, imstr);
c-ims = parseHTTPdate(imstr);
if (c-ims == BAD_DATE) /* bad or out of range date; remove it */
  - table_set(r-headers_in, If-Modified-Since, NULL);
  + table_unset(r-headers_in, If-Modified-Since);
   }
   
   /* find the filename for this cache entry */
  @@ -563,9 +563,11 @@
/* CHECKME: surely this was wrong? (Ben)
   p = table_get(r-headers_in, Expires);
 */
  - p = table_get(c-hdrs, Expires);
  - if (p != NULL)
  - table_set(r-headers_out, Expires, p);
  + struct hdr_entry *q;
  +
  + q = proxy_get_header(c-hdrs, Expires);
  + if (q != NULL  q-value != NULL)
  + table_set(r-headers_out, Expires, q-value);
}
pclosef(r-pool, cachefp-fd);
Explain0(Use local copy, cached file hasn't changed);
  
  
  


cvs commit: apachen/src/modules/proxy proxy_cache.c

1997-11-16 Thread marc
marc97/11/15 21:55:11

  Modified:src/modules/proxy proxy_cache.c
  Log:
  Fix warning caused by conflicting declarations of help_proxy_garbage_coll.
  
  Revision  ChangesPath
  1.31  +1 -1  apachen/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- proxy_cache.c 1997/11/05 12:48:21 1.30
  +++ proxy_cache.c 1997/11/16 05:55:10 1.31
  @@ -130,7 +130,7 @@
   }
   
   
  -void help_proxy_garbage_coll(request_rec *r)
  +static void help_proxy_garbage_coll(request_rec *r)
   {
   const char *cachedir;
   void *sconf = r-server-module_config;
  
  
  


cvs commit: apachen/src/modules/proxy proxy_cache.c proxy_ftp.c proxy_http.c proxy_util.c

1997-09-17 Thread Dean Gaudet
dgaudet 97/09/17 17:20:25

  Modified:src/modules/proxy proxy_cache.c proxy_ftp.c proxy_http.c
proxy_util.c
  Log:
  mod_proxy uses char *p and pool *pool a whole bunch ... which is not
  exactly the style we use elsewhere in the code.  Clean this up.
  
  I'm not sure, but proxy_cache.c had some interesting -Wshadow warnings
  involving a global time_t now and local time_t nows... I changed the
  name of the global to garbage_now.
  
  Other similar fixes.  This is just syntactic sugar similar to the indent
  changes.  I avoided fixing obvious segfault bugs I saw while doing this.
  
  The entire server should now pass gcc -Wshadow, which makes me a bit
  happier.
  
  Revision  ChangesPath
  1.28  +13 -13apachen/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- proxy_cache.c 1997/09/16 00:59:39 1.27
  +++ proxy_cache.c 1997/09/18 00:20:18 1.28
  @@ -90,7 +90,7 @@
   
   static int curbytes, cachesize, every;
   static unsigned long int curblocks;
  -static time_t now, expire;
  +static time_t garbage_now, garbage_expire;
   static char *filename;
   static mutex *garbage_mutex = NULL;
   
  @@ -148,8 +148,8 @@
   
   if (cachedir == NULL || every == -1)
return;
  -now = time(NULL);
  -if (now != -1  lastcheck != BAD_DATE  now  lastcheck + every)
  +garbage_now = time(NULL);
  +if (garbage_now != -1  lastcheck != BAD_DATE  garbage_now  
lastcheck + every)
return;
   
   block_alarms();  /* avoid SIGALRM on big cache cleanup */
  @@ -167,7 +167,7 @@
if (errno != EEXIST)
proxy_log_uerror(creat, filename, NULL, r-server);
else
  - lastcheck = abs(now);   /* someone else got in there */
  + lastcheck = abs(garbage_now);   /* someone else got in there */
unblock_alarms();
return;
}
  @@ -175,7 +175,7 @@
   }
   else {
lastcheck = buf.st_mtime;   /* save the time */
  - if (now  lastcheck + every) {
  + if (garbage_now  lastcheck + every) {
unblock_alarms();
return;
}
  @@ -199,7 +199,7 @@
   for (i = 0; i  files-nelts; i++) {
fent = elts[i];
sprintf(filename, %s%s, cachedir, fent-file);
  - Explain3(GC Unlinking %s (expiry %ld, now %ld), filename, 
fent-expire, now);
  + Explain3(GC Unlinking %s (expiry %ld, garbage_now %ld), filename, 
fent-garbage_expire, garbage_now);
   #if TESTING
fprintf(stderr, Would unlink %s\n, filename);
   #else
  @@ -259,8 +259,8 @@
if (errno != ENOENT)
proxy_log_uerror(stat, filename, NULL, r-server);
}
  - else if (now != -1  buf.st_atime  now - SEC_ONE_DAY 
  -  buf.st_mtime  now - SEC_ONE_DAY) {
  + else if (garbage_now != -1  buf.st_atime  garbage_now - 
SEC_ONE_DAY 
  +  buf.st_mtime  garbage_now - SEC_ONE_DAY) {
Explain1(GC unlink %s, filename);
   #if TESTING
fprintf(stderr, Would unlink %s\n, filename);
  @@ -314,12 +314,12 @@
}
close(fd);
line[i] = '\0';
  - expire = proxy_hex2sec(line + 18);
  + garbage_expire = proxy_hex2sec(line + 18);
if (!checkmask(line,   ) ||
  - expire == BAD_DATE) {
  + garbage_expire == BAD_DATE) {
/* bad file */
  - if (now != -1  buf.st_atime  now + SEC_ONE_DAY 
  - buf.st_mtime  now + SEC_ONE_DAY) {
  + if (garbage_now != -1  buf.st_atime  garbage_now + SEC_ONE_DAY 
  + buf.st_mtime  garbage_now + SEC_ONE_DAY) {
log_error(proxy: deleting bad cache file, r-server);
   #if TESTING
fprintf(stderr, Would unlink bad file %s\n, filename);
  @@ -340,7 +340,7 @@
 */
fent = palloc(r-pool, sizeof(struct gc_ent));
fent-len = buf.st_size;
  - fent-expire = expire;
  + fent-expire = garbage_expire;
strcpy(fent-file, cachesubdir);
strcat(fent-file, ent-d_name);
*(struct gc_ent **) push_array(files) = fent;
  
  
  
  1.39  +58 -59apachen/src/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===
  RCS file: /export/home/cvs/apachen/src/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- proxy_ftp.c   1997/09/16 00:59:40 1.38
  +++ proxy_ftp.c   1997/09/18 00:20:19 1.39
  @@ -105,13 +105,13 @@
*/
   int proxy_ftp_canon(request_rec *r, char *url)
   {
  -char *user, *password, *host, *path, *parms, *p, sport[7];
  -pool *pool = r-pool;
  +char *user,