You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2017/03/18 02:51:02 UTC

svn commit: r1787525 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_autoindex.xml modules/generators/mod_autoindex.c

Author: covener
Date: Sat Mar 18 02:51:02 2017
New Revision: 1787525

URL: http://svn.apache.org/viewvc?rev=1787525&view=rev
Log:
Add IndexOptions UseOldDateFormat

  *) mod_autoindex: Add IndexOptions UseOldDateFormat to allow the date
     format from 2.2 in the Last Modified column. PR60846.
  
   PR34014 / r903052 changed date format for autoindex 

Submitted By: Hank Ibell <hwibell gmail.com>



Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml
    httpd/httpd/trunk/modules/generators/mod_autoindex.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1787525&r1=1787524&r2=1787525&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Mar 18 02:51:02 2017
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_autoindex: Add IndexOptions UseOldDateFormat to allow the date
+     format from 2.2 in the Last Modified column. PR60846.
+     [Hank Ibell <hwibell gmail.com>]
+
   *) mod_http2: fixed PR60869 by making h2 workers exit explicitly waking up
      all threads to exit in a defined way. [Stefan Eissing]
      

Modified: httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml?rev=1787525&r1=1787524&r2=1787525&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml (original)
+++ httpd/httpd/trunk/docs/manual/mod/mod_autoindex.xml Sat Mar 18 02:51:02 2017
@@ -898,6 +898,16 @@ indexing</description>
       </highlight>
       </dd>
 
+      <dt><a name="indexoptions.useolddateformat"
+               id="indexoptions.useolddateformat"
+      >UseOldDateFormat</a>
+      (<em>Apache HTTP Server 2.4.26 and later</em>)</dt>
+
+      <dd>The date format used for the <code>Last Modified</code> field was 
+      inadvertently changed to <code>"%Y-%m-%d %H:%M"</code> from 
+      <code>"%d-%b-%Y %H:%M"</code> in 2.4.0. Setting this option 
+      restores the date format from 2.2 and earlier.</dd>
+
       <dt><a name="indexoptions.versionsort"
                id="indexoptions.versionsort">VersionSort</a>
       (<em>Apache HTTP Server 2.0a3 and later</em>)</dt>

Modified: httpd/httpd/trunk/modules/generators/mod_autoindex.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_autoindex.c?rev=1787525&r1=1787524&r2=1787525&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_autoindex.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_autoindex.c Sat Mar 18 02:51:02 2017
@@ -144,6 +144,7 @@ typedef struct autoindex_config_struct {
 
     char *ctype;
     char *charset;
+    char *datetime_format;
 } autoindex_config_rec;
 
 static char c_by_encoding, c_by_type, c_by_path;
@@ -497,6 +498,9 @@ static const char *add_opts(cmd_parms *c
         else if (!strncasecmp(w, "Charset=", 8)) {
             d_cfg->charset = apr_pstrdup(cmd->pool, &w[8]);
         }
+        else if (!strncasecmp(w, "UseOldDateFormat", 16)) {
+            d_cfg->datetime_format = "%d-%b-%Y %H:%M";
+        }
         else {
             return "Invalid directory indexing option";
         }
@@ -656,6 +660,7 @@ static void *merge_autoindex_configs(apr
 
     new->ctype = add->ctype ? add->ctype : base->ctype;
     new->charset = add->charset ? add->charset : base->charset;
+    new->datetime_format = add->datetime_format ? add->datetime_format : base->datetime_format;
 
     new->alt_list = apr_array_append(p, add->alt_list, base->alt_list);
     new->desc_list = apr_array_append(p, add->desc_list, base->desc_list);
@@ -1509,6 +1514,7 @@ static void output_directories(struct en
     apr_pool_t *scratch;
     int name_width;
     int desc_width;
+    char *datetime_format;
     char *name_scratch;
     char *pad_scratch;
     char *breakrow = "";
@@ -1517,6 +1523,7 @@ static void output_directories(struct en
 
     name_width = d->name_width;
     desc_width = d->desc_width;
+    datetime_format = d->datetime_format ? d->datetime_format : "%Y-%m-%d %H:%M";
 
     if ((autoindex_opts & (FANCY_INDEXING | TABLE_INDEXING))
                         == FANCY_INDEXING) {
@@ -1756,9 +1763,9 @@ static void output_directories(struct en
                     apr_time_exp_t ts;
                     apr_time_exp_lt(&ts, ar[x]->lm);
                     apr_strftime(time_str, &rv, sizeof(time_str),
-                                 "%Y-%m-%d %H:%M  ",
+                                 datetime_format,
                                  &ts);
-                    ap_rvputs(r, "</td><td", (d->style_sheet != NULL) ? " class=\"indexcollastmod\">" : " align=\"right\">",time_str, NULL);
+                    ap_rvputs(r, "</td><td", (d->style_sheet != NULL) ? " class=\"indexcollastmod\">" : " align=\"right\">", time_str, "  ", NULL);
                 }
                 else {
                     ap_rvputs(r, "</td><td", (d->style_sheet != NULL) ? " class=\"indexcollastmod\">&nbsp;" : ">&nbsp;", NULL);
@@ -1844,8 +1851,9 @@ static void output_directories(struct en
                     apr_time_exp_t ts;
                     apr_time_exp_lt(&ts, ar[x]->lm);
                     apr_strftime(time_str, &rv, sizeof(time_str),
-                                "%Y-%m-%d %H:%M  ", &ts);
-                    ap_rputs(time_str, r);
+                                datetime_format,
+                                &ts);
+                    ap_rvputs(r, time_str, "  ", NULL);
                 }
                 else {
                     /*Length="1975-04-07 01:23  " (see 4 lines above) */



Re: svn commit: r1787525 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_autoindex.xml modules/generators/mod_autoindex.c

Posted by Eric Covener <co...@gmail.com>.
On Sat, Mar 18, 2017 at 4:08 AM, Marion & Christophe JAILLET
<ch...@wanadoo.fr> wrote:
> So I think that there is a small display artifact and that there is 1 extra
> space when the "%Y-%m-%d %H:%M" format is used.
>
> I've not tested, so I don't know if it makes a real difference.
>
> Also the comment should be changed in something like /* Length="22-Feb-1998
> 23:42  " or Length="1975-04-07 01:23  ". See 'datetime_format' definition */


Thanks, comment updated in r1787553.  I left the whitespace as-is,
since this retains how both versions have been appearing.

-- 
Eric Covener
covener@gmail.com

Re: svn commit: r1787525 - in /httpd/httpd/trunk: CHANGES docs/manual/mod/mod_autoindex.xml modules/generators/mod_autoindex.c

Posted by Marion & Christophe JAILLET <ch...@wanadoo.fr>.

Le 18/03/2017 � 03:51, covener@apache.org a �crit :
> Author: covener
> Date: Sat Mar 18 02:51:02 2017
> New Revision: 1787525
>
> URL: http://svn.apache.org/viewvc?rev=1787525&view=rev
> Log:
> Add IndexOptions UseOldDateFormat
>
>    *) mod_autoindex: Add IndexOptions UseOldDateFormat to allow the date
>       format from 2.2 in the Last Modified column. PR60846.
>    
>     PR34014 / r903052 changed date format for autoindex
>
> [...]
>
> @@ -1844,8 +1851,9 @@ static void output_directories(struct en
>                       apr_time_exp_t ts;
>                       apr_time_exp_lt(&ts, ar[x]->lm);
>                       apr_strftime(time_str, &rv, sizeof(time_str),
> -                                "%Y-%m-%d %H:%M  ", &ts);
> -                    ap_rputs(time_str, r);
> +                                datetime_format,
> +                                &ts);
> +                    ap_rvputs(r, time_str, "  ", NULL);
>                   }
>                   else {
>                       /*Length="1975-04-07 01:23  " (see 4 lines above) */

The lines below have been changed this way in r903052:

-                    /*Length="22-Feb-1998 23:42  " (see 4 lines above) */
+                    /*Length="1975-04-07 01:23  " (see 4 lines above) */
                      ap_rputs("                   ", r);


So I think that there is a small display artifact and that there is 1 
extra space when the "%Y-%m-%d %H:%M" format is used.

I've not tested, so I don't know if it makes a real difference.

Also the comment should be changed in something like /* 
Length="22-Feb-1998 23:42  " or Length="1975-04-07 01:23  ". See 
'datetime_format' definition */

CJ