You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by laurent Mazier <la...@esf.ericsson.se> on 2000/02/03 10:16:07 UTC

mod_autoindex/5691: Patch : Last-modified field set when using AutoIndexing

>Number:         5691
>Category:       mod_autoindex
>Synopsis:       Patch : Last-modified field set when using AutoIndexing
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Thu Feb 03 01:20:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     laurent.mazier@esf.ericsson.se
>Release:        1.3.6
>Organization:
apache
>Environment:
Solaris 2.7, gcc 2.95.2
>Description:
Search engines often use the "last-modified" field to update or not their database.

Apache 1.3.6 does not provide any modification time when using autoindexing.

The following patch allows to send a "last-modified" field according to the directory modification time.
>How-To-Repeat:

>Fix:
diff -u --recursive apache_1.3.6/src/modules/standard/mod_autoindex.c apache_1.3.6.patch/src/modules/standard/mod_autoindex.c
--- apache_1.3.6/src/modules/standard/mod_autoindex.c	Mon Jan  4 20:49:41 1999
+++ apache_1.3.6.patch/src/modules/standard/mod_autoindex.c	Thu Feb  3 09:20:54 2000
@@ -1331,6 +1331,7 @@
     int autoindex_opts = autoindex_conf->opts;
     char keyid;
     char direction;
+    struct stat st_buf;

     if (!(d = ap_popendir(r->pool, name))) {
 	ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
@@ -1339,6 +1340,13 @@
     }

     r->content_type = "text/html";
+
+    /* give page modification time according to directory modification time */
+    if (stat(r->filename, &st_buf) == 0)
+    {
+	r->mtime = st_buf.st_mtime;
+        ap_set_last_modified(r);
+    }

     ap_send_http_header(r);
>Release-Note:
>Audit-Trail:
>Unformatted:
 [In order for any reply to be added to the PR database, you need]
 [to include <ap...@Apache.Org> in the Cc line and make sure the]
 [subject line starts with the report component and number, with ]
 [or without any 'Re:' prefixes (such as "general/1098:" or      ]
 ["Re: general/1098:").  If the subject doesn't match this       ]
 [pattern, your message will be misfiled and ignored.  The       ]
 ["apbugs" address is not added to the Cc line of messages from  ]
 [the database automatically because of the potential for mail   ]
 [loops.  If you do not include this Cc, your reply may be ig-   ]
 [nored unless you are responding to an explicit request from a  ]
 [developer.  Reply only with text; DO NOT SEND ATTACHMENTS!     ]