https://redmine.lighttpd.net/https://redmine.lighttpd.net/favicon.ico?13667327412009-08-05T00:38:16Zlighty labsLighttpd - Bug #2047: lighttpd issue with DST and If-Modified-Sincehttps://redmine.lighttpd.net/issues/2047?journal_id=62592009-08-05T00:38:16Zoptikal
<ul><li><strong>Target version</strong> set to <i>1.4.23</i></li></ul> Lighttpd - Bug #2047: lighttpd issue with DST and If-Modified-Sincehttps://redmine.lighttpd.net/issues/2047?journal_id=62602009-08-05T00:51:27Zoptikal
<ul></ul><p>Here is a clearer example:</p>
<p>Date set to exactly 1 hour before 'last-modified' date:</p>
<p>curl -I -s -H "Host: example.com" -H "If-Modified-Since: Wed, 04 Aug 2009 23:47:19 GMT" <a class="external" href="http://example.com/example.css">http://example.com/example.css</a><br />HTTP/1.1 304 Not Modified<br />Content-Type: text/css<br />Accept-Ranges: bytes<br />ETag: "1397551174" <br />Last-Modified: Wed, 05 Aug 2009 00:47:19 GMT<br />Date: Wed, 05 Aug 2009 00:47:52 GMT<br />Server: lighttpd</p>
<p>Date set to 1 hour and 1 second before last-modified date:</p>
<p>curl -I -s -H "Host: example.com" -H "If-Modified-Since: Wed, 04 Aug 2009 23:47:18 GMT" <a class="external" href="http://example.com/example.css">http://example.com/example.css</a><br />HTTP/1.1 200 OK<br />Content-Type: text/css<br />Accept-Ranges: bytes<br />ETag: "1397551174" <br />Last-Modified: Wed, 05 Aug 2009 00:47:19 GMT<br />Content-Length: 25<br />Date: Wed, 05 Aug 2009 00:47:58 GMT<br />Server: lighttpd</p> Lighttpd - Bug #2047: lighttpd issue with DST and If-Modified-Sincehttps://redmine.lighttpd.net/issues/2047?journal_id=62612009-08-05T06:31:30Zstbuehler
<ul><li><strong>Target version</strong> changed from <i>1.4.23</i> to <i>1.4.24</i></li></ul><p>ARGS! Even after i disabled setting Target version to aready released versions in the "new issue" and "update issue" form people still don't get it -.-</p> Lighttpd - Bug #2047: lighttpd issue with DST and If-Modified-Sincehttps://redmine.lighttpd.net/issues/2047?journal_id=62672009-08-05T18:35:29Zstbuehler
<ul></ul><p>I think your strptime overrides tm_isdst (or mktime is broken); you could try setting it to 0 again after strptime (src/http-header-glue.c line 334), before mktime.</p> Lighttpd - Bug #2047: lighttpd issue with DST and If-Modified-Sincehttps://redmine.lighttpd.net/issues/2047?journal_id=62682009-08-05T18:43:14Zoptikal
<ul></ul><p>I added `tm.tm_isdst = 0;' just before t_header = mktime(&tm);, recompiled and same issue as before.</p> Lighttpd - Bug #2047: lighttpd issue with DST and If-Modified-Sincehttps://redmine.lighttpd.net/issues/2047?journal_id=62692009-08-05T21:49:24Zstbuehler
<ul></ul><p>mktime changes tm_isdst; that behaviour isn't documented in the manpage, and wrong imho:<br />(posix: <a class="external" href="http://www.opengroup.org/onlinepubs/009695399/functions/mktime.html">http://www.opengroup.org/onlinepubs/009695399/functions/mktime.html</a>)</p>
<blockquote>
<p>Upon successful completion, the values of the tm_wday and tm_yday components of the structure shall be set appropriately, and the other components are set to represent the specified time since the Epoch, but with their values forced to the ranges indicated in the <time.h> entry; the final value of tm_mday shall not be set until tm_mon and tm_year are determined.</p>
</blockquote>
<p>As the tm_isdst field is "within the range" (no range specified, but all values are "valid" as their interpretation is specified), i don't see a reason to change it.</p>
<p>In eglibc (used in debian), strptime sets tm_isdst to zero, so you don't see the problem there.</p>
<p>The solution is to add tm.tm_isdst = 0 before every call to mktime.</p> Lighttpd - Bug #2047: lighttpd issue with DST and If-Modified-Sincehttps://redmine.lighttpd.net/issues/2047?journal_id=62702009-08-05T21:54:15Zoptikal
<ul></ul><p>That solution does indeed work. Thanks!</p> Lighttpd - Bug #2047: lighttpd issue with DST and If-Modified-Sincehttps://redmine.lighttpd.net/issues/2047?journal_id=62712009-08-06T08:35:04Zstbuehler
<ul><li><strong>Status</strong> changed from <i>New</i> to <i>Fixed</i></li><li><strong>% Done</strong> changed from <i>0</i> to <i>100</i></li></ul><p>Applied in changeset r2608.</p>