You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by re...@apache.org on 2004/02/03 22:51:39 UTC
cvs commit: httpd-2.0/modules/metadata mod_expires.c
rederpj 2004/02/03 13:51:39
Modified: . Tag: APACHE_2_0_BRANCH CHANGES STATUS
modules/metadata Tag: APACHE_2_0_BRANCH mod_expires.c
Log:
*) Add support for IMT minor-type wildcards (e.g., text/*) to ExpiresByType. PR#7991
Submitted by: Ken Coar
Reviewed By: ken, stoddard, rederpj
Revision Changes Path
No revision
No revision
1.988.2.232 +3 -0 httpd-2.0/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/httpd-2.0/CHANGES,v
retrieving revision 1.988.2.231
retrieving revision 1.988.2.232
diff -u -r1.988.2.231 -r1.988.2.232
--- CHANGES 3 Feb 2004 15:30:57 -0000 1.988.2.231
+++ CHANGES 3 Feb 2004 21:51:37 -0000 1.988.2.232
@@ -1,5 +1,8 @@
Changes with Apache 2.0.49
+ *) Add support for IMT minor-type wildcards (e.g., text/*) to
+ ExpiresByType. PR#7991 [Ken Coar]
+
*) Fix segfault in mod_mem_cache cache_insert() due to cache size
becoming negative. PR: 21285, 21287
[Bill Stoddard, Massimo Torquati, Jean-Jacques Clar]
1.751.2.670 +1 -5 httpd-2.0/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/httpd-2.0/STATUS,v
retrieving revision 1.751.2.669
retrieving revision 1.751.2.670
diff -u -r1.751.2.669 -r1.751.2.670
--- STATUS 3 Feb 2004 15:30:57 -0000 1.751.2.669
+++ STATUS 3 Feb 2004 21:51:38 -0000 1.751.2.670
@@ -160,10 +160,6 @@
shows breakage on Solaris which can't -lcrypto -lssl without
the extra pkgconfig/openssl.pc Libs: * foo }
- * Backport wildcard ExpiresByType patch
- modules/metadata/mod_expires.c r1.45
- +1: ken, stoddard, rederpj
-
* PREREQ for another fix (stranded piped logger processes) -
ap_mpm_query(AP_MPMQ_MPM_STATE)
No updates are available at present for the BeOS or OS/2 MPMs,
No revision
No revision
1.39.2.8 +40 -3 httpd-2.0/modules/metadata/mod_expires.c
Index: mod_expires.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_expires.c,v
retrieving revision 1.39.2.7
retrieving revision 1.39.2.8
diff -u -r1.39.2.7 -r1.39.2.8
--- mod_expires.c 7 Jan 2004 02:49:46 -0000 1.39.2.7
+++ mod_expires.c 3 Feb 2004 21:51:38 -0000 1.39.2.8
@@ -209,6 +209,7 @@
typedef struct {
int active;
+ int wildcards;
char *expiresdefault;
apr_table_t *expiresbytype;
} expires_dir_config;
@@ -228,6 +229,7 @@
expires_dir_config *new =
(expires_dir_config *) apr_pcalloc(p, sizeof(expires_dir_config));
new->active = ACTIVE_DONTCARE;
+ new->wildcards = 0;
new->expiresdefault = NULL;
new->expiresbytype = apr_table_make(p, 4);
return (void *) new;
@@ -358,7 +360,13 @@
{
expires_dir_config *dir_config = in_dir_config;
char *response, *real_code;
+ char *check;
+ check = strrchr(mime, '/');
+ if ((strlen(++check) == 1) && (*check == '*')) {
+ dir_config->wildcards = 1;
+ }
+
if ((response = check_code(cmd->pool, code, &real_code)) == NULL) {
apr_table_setn(dir_config->expiresbytype, mime, real_code);
return NULL;
@@ -411,7 +419,7 @@
else {
new->expiresdefault = base->expiresdefault;
}
-
+ new->wildcards = add->wildcards;
new->expiresbytype = apr_table_overlay(p, add->expiresbytype,
base->expiresbytype);
return new;
@@ -509,8 +517,37 @@
expiry = apr_table_get(conf->expiresbytype,
ap_field_noparam(r->pool, r->content_type));
if (expiry == NULL) {
- /* Use the ExpiresDefault directive */
- expiry = conf->expiresdefault;
+ int usedefault = 1;
+ /*
+ * See if we have a wildcard entry for the major type.
+ */
+ if (conf->wildcards) {
+ char *checkmime;
+ char *spos;
+ checkmime = apr_pstrdup(r->pool, r->content_type);
+ spos = strchr(checkmime, '/');
+ if (spos != NULL) {
+ /*
+ * Without a '/' character, nothing we have will match.
+ * However, we have one.
+ */
+ if (strlen(++spos) > 0) {
+ *spos++ = '*';
+ *spos = '\0';
+ }
+ else {
+ checkmime = apr_pstrcat(r->pool, checkmime, "*", NULL);
+ }
+ expiry = apr_table_get(conf->expiresbytype, checkmime);
+ usedefault = (expiry == NULL);
+ }
+ }
+ if (usedefault) {
+ /*
+ * Use the ExpiresDefault directive
+ */
+ expiry = conf->expiresdefault;
+ }
}
if (expiry != NULL) {
set_expiration_fields(r, expiry, t);
Re: cvs commit: httpd-2.0/modules/metadata mod_expires.c
Posted by Jeff Trawick <tr...@attglobal.net>.
Geoffrey Young wrote:
>>(thank goodness for cron)
>
>
> and -Werror :)
vendor compilers for Unix-ish systems have a nasty habit of rejecting invalid
C... no non-default settings required ;)
Re: cvs commit: httpd-2.0/modules/metadata mod_expires.c
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> yes, I was just about to post this :)
:)
> (thank goodness for cron)
and -Werror :)
so I guess that makes at least two who build nightly. just out of
curiosity, is anyone else?
--Geoff
Re: cvs commit: httpd-2.0/modules/metadata mod_expires.c
Posted by Jeff Trawick <tr...@attglobal.net>.
Geoffrey Young wrote:
>>That introduced a warning to the 2.0 build:
>>
>>mod_expires.c: In function `set_expiresbytype':
>>mod_expires.c:365: warning: passing arg 1 of `ap_strrchr' discards qualifiers from pointer target type
>
>
> the next version up in HEAD contains the fix
>
> http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/metadata/mod_expires.c?r1=1.45&r2=1.46&only_with_tag=MAIN
>
> --Geoff
yes, I was just about to post this :) (thank goodness for cron)
so that's 2 +1s for backport of the fix... do we hear a third?
Re: cvs commit: httpd-2.0/modules/metadata mod_expires.c
Posted by Geoffrey Young <ge...@modperlcookbook.org>.
> That introduced a warning to the 2.0 build:
>
> mod_expires.c: In function `set_expiresbytype':
> mod_expires.c:365: warning: passing arg 1 of `ap_strrchr' discards qualifiers from pointer target type
the next version up in HEAD contains the fix
http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/metadata/mod_expires.c?r1=1.45&r2=1.46&only_with_tag=MAIN
--Geoff
Re: cvs commit: httpd-2.0/modules/metadata mod_expires.c
Posted by Joe Orton <jo...@redhat.com>.
On Tue, Feb 03, 2004 at 09:51:39PM -0000, rederpj@apache.org wrote:
> rederpj 2004/02/03 13:51:39
>
> Modified: . Tag: APACHE_2_0_BRANCH CHANGES STATUS
> modules/metadata Tag: APACHE_2_0_BRANCH mod_expires.c
> Log:
> *) Add support for IMT minor-type wildcards (e.g., text/*) to ExpiresByType. PR#7991
That introduced a warning to the 2.0 build:
mod_expires.c: In function `set_expiresbytype':
mod_expires.c:365: warning: passing arg 1 of `ap_strrchr' discards qualifiers from pointer target type
joe