www-apache-bugdb mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul J Murphy <P...@murph.org>
Subject Re: mod_expires/8388: ExpiresByType type wildcard support
Date Sun, 23 Sep 2001 15:40:00 GMT
The following reply was made to PR mod_expires/8388; it has been noted by GNATS.

From: Paul J Murphy <Paul@murph.org>
To: <apbugs@apache.org>
Cc:  
Subject: Re: mod_expires/8388: ExpiresByType type wildcard support
Date: Sun, 23 Sep 2001 16:39:37 +0100 (BST)

 Having reviewed my code, I think I made it a little too complex, and
 possibly broke inheritance in the process.
 
 Here is a new patch with a slightly simpler ap_table_match
 
 Inheritance seems to work reasonably intuitively with this version. It's a
 simple first match wins, rather than best match wins, which is what my
 previous patch attempted to do.
 
 
 Paul.
 
 diff -cr apache_1.3.20/src/include/ap_alloc.h apache_1.3.20-murph/src/include/ap_alloc.h
 *** apache_1.3.20/src/include/ap_alloc.h	Sat Feb  3 20:14:49 2001
 --- apache_1.3.20-murph/src/include/ap_alloc.h	Sat Sep 22 14:26:04 2001
 ***************
 *** 225,230 ****
 --- 225,231 ----
   API_EXPORT(table *) ap_copy_table(pool *p, const table *);
   API_EXPORT(void) ap_clear_table(table *);
   API_EXPORT(const char *) ap_table_get(const table *, const char *);
 + API_EXPORT(const char *) ap_table_match(const table *, const char *);
   API_EXPORT(void) ap_table_set(table *, const char *name, const char *val);
   API_EXPORT(void) ap_table_setn(table *, const char *name, const char *val);
   API_EXPORT(void) ap_table_merge(table *, const char *name, const char *more_val);
 diff -cr apache_1.3.20/src/main/alloc.c apache_1.3.20-murph/src/main/alloc.c
 *** apache_1.3.20/src/main/alloc.c	Mon Jan 15 17:04:55 2001
 --- apache_1.3.20-murph/src/main/alloc.c	Sun Sep 23 16:07:45 2001
 ***************
 *** 1249,1254 ****
 --- 1249,1271 ----
       return NULL;
   }
 
 + API_EXPORT(const char *) ap_table_match(const table *t, const char *key)
 + {
 +     table_entry *elts = (table_entry *) t->a.elts;
 +     int i;
 +
 +     if (key == NULL)
 + 	return NULL;
 +
 +     match_len = 0;
 +
 +     for (i = 0; i < t->a.nelts; ++i)
 + 	if (!ap_strcasecmp_match(key, elts[i].key))
 + 	    return elts[i].val;
 +
 +     return NULL;
 + }
 +
   API_EXPORT(void) ap_table_set(table *t, const char *key, const char *val)
   {
       register int i, j, k;
 diff -cr apache_1.3.20/src/modules/standard/mod_expires.c apache_1.3.20-murph/src/modules/standard/mod_expires.c
 *** apache_1.3.20/src/modules/standard/mod_expires.c	Mon Jan 15 17:05:41 2001
 --- apache_1.3.20-murph/src/modules/standard/mod_expires.c	Sat Sep 22 14:01:44 2001
 ***************
 *** 438,444 ****
       if (r->content_type == NULL)
           code = NULL;
       else
 !         code = (char *) ap_table_get(conf->expiresbytype,
   		ap_field_noparam(r->pool, r->content_type));
 
       if (code == NULL) {
 --- 438,444 ----
       if (r->content_type == NULL)
           code = NULL;
       else
 !         code = (char *) ap_table_match(conf->expiresbytype,
   		ap_field_noparam(r->pool, r->content_type));
 
       if (code == NULL) {
 

Mime
View raw message