Bug #1997
mod_expire overwrites header Cache-Control
| Status: | Fixed | Start date: | 2009-06-03 | |
|---|---|---|---|---|
| Priority: | Low | Due date: | ||
| Assignee: | - | % Done: | 100% | |
| Category: | mod_expire | |||
| Target version: | 1.4.24 | |||
| Missing in 1.5.x: |
Description
Hi,
mod_expire.c; line 345; function URIHANDLER_FUNC()
My english is not that good, but let me try to explain why overwritten header Cache-Control maybe have unwanted effects. By this behavior values like RFC 2616 section 14.9.* will be not send. The given cache policy forfeit for resources. For example I set Cache-Control: no-transform, private and I like to manifest an expire, an intermediate cache could transform and/or store it unwanted.
Easiest way could be, leave this header untouched by mod_expire. So an admin have to advocate for its own oppositional configuration.
With best regrads from Berlin
History
#1 Updated by darix almost 4 years ago
can you please add the relevant parts of your config?
#2 Updated by stbuehler almost 4 years ago
- Target version changed from 1.4.23 to 1.4.24
#3 Updated by eddi almost 4 years ago
$HTTP["url"] =~ "\.(bmp|gif|jpg|png|tiff|psd|xbm|xpm|xwd)$" {
expire.url =(""=>"access 10 days")
setenv.add-response-header=("Cache-Control"=>"private,no-transform")
}
In my opinion it is caused by mod_expire.c, lines 342 till 345.
buffer_copy_string_len(p->expire_tstmp, CONST_STR_LEN("max-age="));
buffer_append_long(p->expire_tstmp, ts);
response_header_overwrite(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));#4 Updated by stbuehler almost 4 years ago
We will not change the current behaviour. If you need customized behaviour, you should probably use mod_magnet (or patch lighty yourself).
#5 Updated by darix almost 4 years ago
eddi wrote:
> $HTTP["url"] =~ ".(bmp|gif|jpg|png|tiff|psd|xbm|xpm|xwd)$" { > expire.url =(""=>"access 10 days") > setenv.add-response-header=("Cache-Control"=>"private,no-transform") > } >In my opinion it is caused by mod_expire.c, lines 342 till 345.
buffer_copy_string_len(p->expire_tstmp, CONST_STR_LEN("max-age="));
buffer_append_long(p->expire_tstmp, ts);response_header_overwrite(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
does it help if you load mod_expire before mod_setenv? order matters.
#6 Updated by stbuehler almost 4 years ago
setenv only appends a second header, expire overwrites it. So no combination is going to work.
#7 Updated by eddi almost 4 years ago
- % Done changed from 0 to 90
Here is a patch
345c345
< response_header_overwrite(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
---
> response_header_insert(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
That's it. It works. It is that plain. It is conform on RFC.
stbuehler wrote:
We will not change the current behaviour. If you need customized behaviour, you should probably use mod_magnet (or patch lighty yourself).
Best way should be to merge values of Cache-Control without include 3rd modules. I please you add it.
With best regrads from Berlin
eddi
#8 Updated by stbuehler almost 4 years ago
This has nothing to do with rfc conform.
mod_magnet is one module, mod_setenv + mod_expire are two modules... so i don't see your problem with mod_magnet.
patches should be created with diff -u, and you should use the "pre" formatting if you inline it. better attach patches to preserve whitespaces.
#9 Updated by eddi almost 4 years ago
stbuehler wrote:
This has nothing to do with rfc conform.
Right.
stbuehler wrote:
mod_magnet is one module, mod_setenv + mod_expire are two modules... so i don't see your problem with mod_magnet.
Right.
My problem: mod_expire comput date of expiration. mod_magnet requires lua on my system to do so as well. mod_magnet requires I have to learn lua, I have to program. Configuration is not longer placed in one file, but would have differed syntax too.
I like to configure lighttpd with KISS in my mind.
stbuehler wrote:
patches should be created with
diff -u, and you should use the "pre" formatting if you inline it. better attach patches to preserve whitespaces.
I am sorry.
--- mod_expire.c.old 2009-06-12 20:41:17.215317444 +0200
+++ mod_expire.c 2009-06-12 21:23:02.250151671 +0200
@@ -342,7 +342,7 @@
buffer_copy_string_len(p->expire_tstmp, CONST_STR_LEN("max-age="));
buffer_append_long(p->expire_tstmp, ts);
- response_header_overwrite(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
+ response_header_insert(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));
return HANDLER_GO_ON;
}
#10 Updated by stbuehler almost 4 years ago
- Status changed from New to Fixed
Fixed in r2589 (wrong commit message)
#11 Updated by eddi almost 4 years ago
- % Done changed from 90 to 100
Thanks. :)))
With best regrads from Berlin
eddi
Also available in: Atom