httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Tromey <tro...@creche.cygnus.com>
Subject another http/1.0 bug in set_last_modified
Date Mon, 23 Sep 1996 17:12:15 GMT
I've found another HTTP/1.0 bug in set_last_modified.  This bug is in
Apache 1.1.1; the current CVS version has a slightly different
incarnation of the bug (which is apparently a bug wrt the HTTP/1.1
spec as well).

Here is the text from section 10.10 ("Last-Modified") of the HTTP/1.0
spec:

  An origin server must not send a Last-Modified date which is later
  than the server's time of message origination. In such cases, where
  the resource's last modification would indicate some time in the
  future, the server must replace that date with the message
  origination date.

My test suite checks this by making a file with a date in the future,
and then comparing the returned Last-Modified and Date fields.

Appended is a patch (relative to all my other patches to this
function) which fixes this bug.

In the current CVS Apache, set_last_modified just returns if the
file's mtime is in the future.  By my reading of the above section,
this is incorrect.  Draft 07 says the same thing as the 1.0 spec
(except that "must" and "must not" are in all caps).  A patch for the
newer Apache should remove the "just return" code, and do something
like the appended patch.

Tom
-- 
tromey@cygnus.com                 Member, League for Programming Freedom

Index: http_protocol.c
===================================================================
RCS file: /rel/cvsfiles/devo/apache/src/http_protocol.c,v
retrieving revision 1.3
diff -c -5 -r1.3 http_protocol.c
*** http_protocol.c	1996/09/19 20:26:29	1.3
--- http_protocol.c	1996/09/23 17:00:54
***************
*** 196,206 ****
       * to have it cached.
       */
      
      if (r->no_cache) return OK;
      
!     ts = gm_timestr_822(r->pool, mtime);
      table_set (r->headers_out, "Last-modified", ts);
  
      /* Check for conditional GETs --- note that we only want this check
       * to succeed if the GET was successful; ErrorDocuments *always* get sent.
       */
--- 196,206 ----
       * to have it cached.
       */
      
      if (r->no_cache) return OK;
      
!     ts = gm_timestr_822(r->pool, (mtime > server_time) ? server_time : mtime);
      table_set (r->headers_out, "Last-modified", ts);
  
      /* Check for conditional GETs --- note that we only want this check
       * to succeed if the GET was successful; ErrorDocuments *always* get sent.
       */

Mime
View raw message