Package: fnord
Version: 1.8-5
Severity: normal
Tags: patch

If-Modified-Since headers are not parsed correctly. They are always
specified as GMT, but fnord parses them as if they were in the local
timezone.

The result is that "304 no change" may be sent for changed content
(if you're east of Greenwich) or content may be retransmitted
needlessly (if you're west of Greenwich).

The patch below fixes it for me. The first hunk is obviously correct
since mktime is, by spec, localtime. The second hunk doesn't belong
here but fixes the infinite loop mentioned in other bug ;) The third
hunk sets timezone explicitly, because it isn't set by dietlibc --
but maybe it should be?

--- fnord-1.9/httpd.c   2005-01-31 17:10:39.000000000 +0100
+++ fnord-1.9-new/httpd.c       2005-02-03 12:54:33.000000000 +0100
@@ -812,7 +812,7 @@
   if (parsetime(c,&x)) return (time_t)-1;
 done:
   x.tm_wday=x.tm_yday=x.tm_isdst=0;
-  return mktime(&x);
+  return mktime(&x)-timezone;
 }
 
 static struct stat st;
@@ -1196,7 +1196,7 @@
       off_t l=rangeend-rangestart;
       do {
        off_t c;
-       c=(l>(1<<31))?1<<31:l;
+       c=(l>(1UL<<31))?1UL<<31:l;
        if (sendfile(1,fd,&offset,c)==-1) break;
        l-=c;
       } while (l);
@@ -1229,6 +1229,10 @@
   int len;
   int in;
 
+  struct timezone tz;
+  gettimeofday(0, &tz);
+  timezone=tz.tz_minuteswest*60L;
+
   if (argc>1) chdir(argv[1]);
 
 #ifdef CHROOT


-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.9-ac5
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to