httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk-Willem van Gulik <Dirk.vanGu...@jrc.it>
Subject Re: [contrib] gif89-expires-hack
Date Tue, 13 Jan 1998 12:53:50 GMT

+1 Works and does make a difference. Wow!

Although it now also affects my normal 89a gif's which
do not cycle. However looking at the graphics control
section (http://www.kiarchive.ru/pub/unix/graphics/
format/gif/gif89a.doc.Z) would require a lot of parsing
throguh the files. So perhaps a separate fake mime
type is needed to make the distinction.

DW.


On Tue, 13 Jan 1998, Dean Gaudet wrote:

> This bug is still around in Mozilla/4.02.  Lame lame lame.  The bug I'm
> referring to is the one that causes the browser to re-request an animated
> gif89a over and over if the response has an Expires... even if the Expires
> is way in the future.  I get really tired of seeing my hit logs fill up
> with a once-per-loop request from every broken browser out there. 
> 
> Here's my patch for it updated from 1.2. 
> 
> Dean
> 
> --- http_core.c.orig	Tue Jan 13 02:24:03 1998
> +++ http_core.c	Tue Jan 13 02:24:43 1998
> @@ -1893,6 +1893,31 @@
>  	if (d->content_md5 & 1) {
>  	    table_set (r->headers_out, "Content-MD5", ap_md5digest(r->pool, f));
>  	}
> +	/* Shameless hack: if the file to be sent is image/gif and
> +	 * gif89-expires-hack is set then remove the Expires header.  This is
> +	 * required because of a bug in Mozilla versions up through at least 4
> +	 * which causes it to re-request the animation every loop.  You
> +	 * probably want this in your config:
> +	 *
> +	 * BrowserMatch Mozilla/[0-4]\. gif89-expires-hack
> +	 *
> +	 * -djg
> +	 */
> +	if (r->content_type
> +	    && strcasecmp (r->content_type, "image/gif") == 0
> +	    && r->finfo.st_size > 6
> +	    && table_get (r->subprocess_env, "gif89-expires-hack")) {
> +#define GIF_HEADER_LEN	(6)
> +	    char gif_header[ GIF_HEADER_LEN ];
> +
> +	    if (fread (gif_header, 1, GIF_HEADER_LEN, f) == GIF_HEADER_LEN
> +		&& memcmp (gif_header, "GIF89a", GIF_HEADER_LEN) == 0) {
> +		table_unset (r->headers_out, "Expires");
> +		table_unset (r->headers_out, "Cache-Control");
> +	    }
> +	    fseek (f, 0L, SEEK_SET);
> +#undef GIF_HEADER_LEN
> +	}
>  
>  	rangestatus = set_byterange(r);
>  	send_http_header (r);
> @@ -1926,6 +1951,15 @@
>  	    MD5Update(&context, (void *)mm, r->finfo.st_size);
>  	    table_set (r->headers_out, "Content-MD5",
>  		ap_md5contextTo64(r->pool, &context));
> +	}
> +	/* Shameless gif89-expires-hack, see above */
> +	if (r->content_type
> +	    && strcasecmp (r->content_type, "image/gif") == 0
> +	    && table_get (r->subprocess_env, "gif89-expires-hack")
> +	    && r->finfo.st_size > 6
> +	    && memcmp (mm, "GIF89a", 6) == 0) {
> +	    table_unset (r->headers_out, "Expires");
> +	    table_unset (r->headers_out, "Cache-Control");
>  	}
>  
>  	rangestatus = set_byterange(r);
> 
> 
> 

http://cils.ceo.org                         http://enrm.ceo.org
dirkx@technologist.com                     Dirk.vanGulik@jrc.it
+39 332 78 0014       +39 332 78 9549       fax +39 332 78 9185
ISEI/ESBA;                     The Center For Earth Observation
Joint Research Centre of the European Communities, Ispra, Italy


Mime
View raw message