https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412009-06-10T14:13:58Zlighty labsLighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=60152009-06-10T14:13:58Zdarix
<ul></ul><p>can you please add the relevant parts of your config?</p> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=60422009-06-10T17:27:23Zstbuehler
<ul><li><strong>Target version</strong> changed from <i>1.4.23</i> to <i>1.4.24</i></li></ul> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=60702009-06-11T22:54:45Zeddi
<ul></ul><p>$HTTP["url"] =~ "\.(bmp|gif|jpg|png|tiff|psd|xbm|xpm|xwd)$" {<br /> expire.url =(""=>"access 10 days")<br /> setenv.add-response-header=("Cache-Control"=>"private,no-transform")<br />}</p>
<p>In my opinion it is caused by mod_expire.c, lines 342 till 345.</p>
<pre><code>buffer_copy_string_len(p->expire_tstmp, CONST_STR_LEN("max-age="));<br /> buffer_append_long(p->expire_tstmp, ts);</code></pre>
<pre><code><strong>response_header_overwrite</strong>(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));</code></pre> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=60712009-06-11T23:00:05Zstbuehler
<ul></ul><p>We will not change the current behaviour. If you need customized behaviour, you should probably use mod_magnet (or patch lighty yourself).</p> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=60722009-06-11T23:19:06Zdarix
<ul></ul><p>eddi wrote:</p>
<blockquote>
<pre>
> $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")
> }
> </pre>
<p>In my opinion it is caused by mod_expire.c, lines 342 till 345.</p>
<p>buffer_copy_string_len(p->expire_tstmp, CONST_STR_LEN("max-age="));<br />buffer_append_long(p->expire_tstmp, ts);</p>
<p><strong>response_header_overwrite</strong>(srv, con, CONST_STR_LEN("Cache-Control"), CONST_BUF_LEN(p->expire_tstmp));</p>
</blockquote>
<p>does it help if you load mod_expire before mod_setenv? order matters.</p> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=60742009-06-12T05:57:47Zstbuehler
<ul></ul><p>setenv only appends a second header, expire overwrites it. So no combination is going to work.</p> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=60782009-06-12T19:49:59Zeddi
<ul><li><strong>% Done</strong> changed from <i>0</i> to <i>90</i></li></ul><p>Here is a patch</p>
<pre>
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));
</pre>
<p>That's it. It works. It is that plain. It is conform on RFC.</p>
<p>stbuehler wrote:</p>
<blockquote>
<p>We will not change the current behaviour. If you need customized behaviour, you should probably use mod_magnet (or patch lighty yourself).</p>
</blockquote>
<p>Best way should be to merge values of <em>Cache-Control</em> without include 3rd modules. I please you add it.</p>
<p>With best regrads from Berlin<br />eddi</p> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=60792009-06-12T20:49:22Zstbuehler
<ul></ul><p>This has nothing to do with rfc conform.</p>
<p>mod_magnet is one module, mod_setenv + mod_expire are two modules... so i don't see your problem with mod_magnet.</p>
<p>patches should be created with <code>diff -u</code>, and you should use the "pre" formatting if you inline it. better attach patches to preserve whitespaces.</p> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=60802009-06-12T21:51:39Zeddi
<ul></ul><p>stbuehler wrote:</p>
<blockquote>
<p>This has nothing to do with rfc conform.</p>
</blockquote>
<p>Right.</p>
<p>stbuehler wrote:</p>
<blockquote>
<p>mod_magnet is one module, mod_setenv + mod_expire are two modules... so i don't see your problem with mod_magnet.</p>
</blockquote>
<p>Right.<br />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.</p>
<p>I like to configure lighttpd with <strong>KISS</strong> in my mind.</p>
<p>stbuehler wrote:</p>
<blockquote>
<p>patches should be created with <code>diff -u</code>, and you should use the "pre" formatting if you inline it. better attach patches to preserve whitespaces.</p>
</blockquote>
<p>I am sorry.</p>
<pre>
--- 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;
}
</pre> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=62262009-07-23T23:35:36Zstbuehler
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Fixed</i></li></ul><p>Fixed in r2589 (wrong commit message)</p> Lighttpd - Bug #1997: mod_expire overwrites header Cache-Controlhttps://redmine.lighttpd.net/issues/1997?journal_id=62342009-07-24T12:18:55Zeddi
<ul><li><strong>% Done</strong> changed from <i>90</i> to <i>100</i></li></ul><p>Thanks. :)))</p>
<p>With best regrads from Berlin<br />eddi</p>