Commit 5dda6dd3 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1787525, r1787553, r1788451 from trunk:

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>




update comments post-r1787525




no strncasecmp because flag has no value

Submitted by: covener
Reviewed by: covener, jim, druggeri


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1789963 13f79535-47bb-0310-9956-ffa450edef68
parent 88a037ad
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -18,6 +18,10 @@ Changes with Apache 2.4.26
  *) mod_http2: obsoleted option H2SessionExtraFiles, will be ignored and
     just log a warning. [Stefan Eissing]
     
  *) 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]
     
+0 −8
Original line number Diff line number Diff line
@@ -118,14 +118,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) mod_autoindex: Add IndexOptions UseOldDateFormat to allow the date
     format from 2.2 in the Last Modified column. PR60846.
     trunk patch: http://svn.apache.org/r1787525
                  http://svn.apache.org/r1787553
                  http://svn.apache.org/r1788451
     2.4.x patch: trunk works
     +1 covener, jim, druggeri

  *) mod_ssl: backport fix for PR 46037
     trunk patch: http://svn.apache.org/r1781575
                  http://svn.apache.org/r1781577
+10 −0
Original line number Diff line number Diff line
@@ -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>
+16 −5
Original line number Diff line number Diff line
@@ -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 *cmd, void *d, int argc, char *const argv[
        else if (!strncasecmp(w, "Charset=", 8)) {
            d_cfg->charset = apr_pstrdup(cmd->pool, &w[8]);
        }
        else if (!strcasecmp(w, "UseOldDateFormat")) {
            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_pool_t *p, void *basev, void *addv)

    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 ent **ar, int n,
    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 ent **ar, int n,

    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 ent **ar, int n,
                    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,11 +1851,15 @@ static void output_directories(struct ent **ar, int n,
                    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) */
                   /* Length="1975-04-07 01:23  "  (default in 2.4 and later) or
                    * Length="07-Apr-1975 01:24  ". (2.2 and UseOldDateFormat) 
                    * See 'datetime_format' above.
                    */
                    ap_rputs("                   ", r);
                }
            }