httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Tromey <tro...@creche.cygnus.com>
Subject http/1.0: more If-Modified-Since
Date Thu, 19 Sep 1996 19:37:19 GMT
The section of the HTTP spec dealing with If-Modified-Since says this:

    a)
      If the request would normally result in anything other than a 200 (ok)
      status, or if the passed If-Modified-Since date is invalid, the response
      is exactly the same as for a normal GET. A date which is later than the
      server's current time is invalid.

This assertion is currently not checked in Apache 1.1.1.  You can
verify this by doing a GET request with an If-Modified-Since date in
the year 2000.

Appended is a patch that fixes this bug.  It has to be applied over my
previous If-Modified-Since patch.

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

? mod_xinclude.c
Index: http_protocol.c
===================================================================
RCS file: /rel/cvsfiles/devo/apache/src/http_protocol.c,v
retrieving revision 1.2
diff -c -5 -r1.2 http_protocol.c
*** http_protocol.c	1996/09/19 18:58:49	1.2
--- http_protocol.c	1996/09/19 19:24:44
***************
*** 182,191 ****
--- 182,192 ----
  
  int set_last_modified(request_rec *r, time_t mtime)
  {
      char *ts;
      char *if_modified_since = table_get (r->headers_in, "If-modified-since");
+     time_t server_time = time (NULL);
  
      /* Cacheing proxies use the absence of a Last-modified header
       * to indicate that a document is dynamic and shouldn't be cached.
       * For the moment, we enforce that here, though it would probably
       * work just as well to generate an Expires: header in send_http_header.
***************
*** 203,213 ****
      /* Check for conditional GETs --- note that we only want this check
       * to succeed if the GET was successful; ErrorDocuments *always* get sent.
       */
      
      if (r->status == 200 && !r->header_only &&
! 	if_modified_since && later_than(gmtime(&mtime), if_modified_since))
        
          return USE_LOCAL_COPY;
      else
          return OK;
  }
--- 204,215 ----
      /* Check for conditional GETs --- note that we only want this check
       * to succeed if the GET was successful; ErrorDocuments *always* get sent.
       */
      
      if (r->status == 200 && !r->header_only &&
! 	if_modified_since && later_than(gmtime(&mtime), if_modified_since)
! 	&& !later_than(gmtime(&server_time), if_modified_since))
        
          return USE_LOCAL_COPY;
      else
          return OK;
  }

Mime
View raw message