akosut      96/08/15 16:41:44

  Modified:    src       http_protocol.c
  Log:
  If a request comes within a second of a file's last-modified date,
  send a weak ETag instead of a strong one. This allows a file to be
  modified twice in one second and still allow strong validation without
  fear of inaccuracies.
  
  Revision  Changes    Path
  1.37      +9 -3      apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -C3 -r1.36 -r1.37
  *** http_protocol.c   1996/08/15 19:22:34     1.36
  --- http_protocol.c   1996/08/15 23:41:43     1.37
  ***************
  *** 343,356 ****
         * length and inode number - note that this doesn't have to match
         * the content-length (i.e. includes), it just has to be unique
         * for the file.
         */
    
        if (r->finfo.st_mode != 0)
  !         sprintf(etag, "\"%lx-%lx-%lx\"", r->finfo.st_ino, r->finfo.st_size,
                mtime);
        else
  !         sprintf(etag, "\"%lx\"", mtime);
  !     table_set (r->headers_out, "ETag", etag);
    
        /* We now do the no_cache stuff using an Expires: header (we used to
         * withhold Last-modified). However, we still want to enforce this by
  --- 343,362 ----
         * length and inode number - note that this doesn't have to match
         * the content-length (i.e. includes), it just has to be unique
         * for the file.
  +      *
  +      * If the request was made within a second of the last-modified date,
  +      * we send a weak tag instead of a strong one, since it could
  +      * be modified again later in the second, and the validation
  +      * would be incorrect.
         */
    
        if (r->finfo.st_mode != 0)
  !         sprintf(etag, "W/\"%lx-%lx-%lx\"", r->finfo.st_ino, 
r->finfo.st_size,
                mtime);
        else
  !         sprintf(etag, "W/\"%lx\"", mtime);
  !     table_set (r->headers_out, "ETag",
  !            etag + ((r->request_time - mtime > 1) ? 2 : 0));
    
        /* We now do the no_cache stuff using an Expires: header (we used to
         * withhold Last-modified). However, we still want to enforce this by
  
  
  

Reply via email to