httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [PATCH] some cleanups and bug fixes
Date Sun, 03 Aug 1997 12:23:19 GMT
Ya know, isn't it bogus to be using mtime to generate an etag if mtime >
now ?

Dean

On Sun, 3 Aug 1997, Dean Gaudet wrote:

> Ah, cute.  So if I understand what you're saying, then this should work: 
> 
>     time_t now;
> 
>     /* For all static responses, it's almost certain that the file was
>      * last modified before the beginning of the request.  So there's
>      * no reason to call time(NULL) again.  But for a slow dynamic
>      * content generator that writes a file to cache the results, the
>      * file's modified time can be later than the beginning of the
>      * request.  now is used to ensure we don't issue a Last-Modified
>      * with a date in the future.
>      */
>     if (mtime <= r->request_time) {
> 	now = r->request_time;
>     } else {
> 	now = time(NULL);
>     }
> 
> Dean
> 
> On Sat, 2 Aug 1997, Roy T. Fielding wrote:
> 
> > >Index: http_protocol.c
> > >===================================================================
> > >RCS file: /export/home/cvs/apache/src/http_protocol.c,v
> > >retrieving revision 1.146
> > >diff -u -r1.146 http_protocol.c
> > >--- http_protocol.c	1997/07/30 18:41:52	1.146
> > >+++ http_protocol.c	1997/07/31 09:31:09
> > >@@ -350,10 +350,9 @@
> > > {
> > >     char *etag, weak_etag[MAX_STRING_LEN];
> > >     char *if_match, *if_modified_since, *if_unmodified, *if_nonematch;
> > >-    time_t now = time(NULL);
> > >+    time_t now;
> > > 
> > >-    if (now < 0)
> > >-        now = r->request_time;
> > >+    now = r->request_time;
> > > 
> > >     table_set(r->headers_out, "Last-Modified",
> > >               gm_timestr_822(r->pool, (mtime > now) ? now : mtime));
> > 
> > -1 this part, +0 on the rest.  A new call to time() is here so that
> > responses generated during the request handling can be simultaneously
> > cached while allowing future conditional GETs to result in a 304 response.
> > In other words, RobH needed it because the request handler is slow and
> > the last line above would cause the delivered Last-Modified to be less
> > than the actual modification date of a dynamically generated response.
> > 
> > ....Roy
> > 
> 
> 


Mime
View raw message