> So, try the following change to your code:
> >
> >     $R->content_type ($data {mimetype});
> >     $R->set_content_length ($data {size});
> >     $R->header_out ('ETag',$data {md5});
>
> don't do that.  use the $r->set_etag method instead, which is probably
> a bit safer than trying to figure out Etag rules yourself.  I'm pretty
> sure that you shouldn't use the Etag header with non-static entities
> anyway, but I could be wrong.

$r->set_etag ends up calling ap_make_etag to generate the ETag (from
$r->mtime and $r->finfo) and setting the ETag header.  That works great for
static content, but for dynamic content you probably don't have valid finfo.
So, generating an ETag yourself seems easier and safer, especially if you
already have an MD5 hash of the content.

Apache's $r->set_etag also satisfies RFC 2295, "Transparent Content
Negotiation in HTTP", by merging the variant list validator with whatever
ap_make_etag returns.  However, ETag's without vlv's are pretty much
backwards compatible.

--
Kyle Oppenheim
Tellme Networks, Inc.
http://www.tellme.com

Reply via email to