dgaudet 97/08/03 19:55:12
Modified: src http_protocol.c
Log:
Change set_last_modified to something that Roy and I are both happy with.
Reviewed by: Roy Fielding
Revision Changes Path
1.149 +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.148
retrieving revision 1.149
diff -u -r1.148 -r1.149
--- http_protocol.c 1997/08/03 21:35:58 1.148
+++ http_protocol.c 1997/08/04 02:55:11 1.149
@@ -350,10 +350,16 @@
{
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;
+ /* 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 if the response has been
+ * created on demand, then it might be newer than the time the request
+ * started. In this event we really have to call time(NULL) again
+ * so that we can give the clients the most accurate Last-Modified.
+ */
+ now = (mtime <= r->request_time) ? r->request_time : time(NULL);
table_set(r->headers_out, "Last-Modified",
gm_timestr_822(r->pool, (mtime > now) ? now : mtime));