httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n.@apache.org
Subject cvs commit: httpd-2.0/modules/generators mod_autoindex.c
Date Mon, 12 Jan 2004 15:54:36 GMT
nd          2004/01/12 07:54:36

  Modified:    .        Tag: APACHE_2_0_BRANCH CHANGES STATUS
               include  Tag: APACHE_2_0_BRANCH ap_mmn.h httpd.h
               modules/generators Tag: APACHE_2_0_BRANCH mod_autoindex.c
  Log:
  allow switching between xhtml and html
  
  PR: 23747
  Reviewed by: Justin Erenkrantz, Jeff Trawick
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.988.2.217 +6 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.988.2.216
  retrieving revision 1.988.2.217
  diff -u -u -r1.988.2.216 -r1.988.2.217
  --- CHANGES	12 Jan 2004 15:02:23 -0000	1.988.2.216
  +++ CHANGES	12 Jan 2004 15:54:35 -0000	1.988.2.217
  @@ -1,5 +1,11 @@
   Changes with Apache 2.0.49
   
  +  *) mod_autoindex: Add 'XHTML' option in order to allow switching between
  +     HTML 3.2 and XHTML 1.0 output. PR 23747.  [André Malo]
  +
  +  *) Add XHTML Document Type Definitions to httpd.h (minor MMN bump).
  +     [André Malo]
  +
     *) mod_ssl: Advertise SSL library version as determined at run-time rather
        than at compile-time.  PR 23956.  [Eric Seidel <seidel apple.com>]
   
  
  
  
  1.751.2.629 +1 -11     httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.628
  retrieving revision 1.751.2.629
  diff -u -u -r1.751.2.628 -r1.751.2.629
  --- STATUS	12 Jan 2004 14:59:16 -0000	1.751.2.628
  +++ STATUS	12 Jan 2004 15:54:35 -0000	1.751.2.629
  @@ -282,16 +282,6 @@
           modules/metadata/mod_setenvif.c: r1.44
         +1: nd, jerenkrantz
   
  -    * mod_autoindex: Allow switching between XHTML and HTML output.
  -      PR 23747. (minor MMN bump).
  -        modules/generators/mod_autoindex.c: r1.124
  -        include/httpd.h: r1.201
  -        include/ap_mmn.h: r1.60
  -      jerenkrantz suggests: Why don't we just always output XHTML instead?
  -      nd replies: backwards compat; it would break those sites who have html
  -      READMEs or HEADERs (or don't want to use xhtml)
  -      +1: nd, jerenkrantz, trawick
  -
       * LDAP cache fixes from Matthieu Estrade; see PR 18756
           include/util_ldap.h r1.12
           modules/experimental/util_ldap.c r1.15, r1.16
  
  
  
  No                   revision
  No                   revision
  1.52.2.8  +2 -1      httpd-2.0/include/ap_mmn.h
  
  Index: ap_mmn.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/ap_mmn.h,v
  retrieving revision 1.52.2.7
  retrieving revision 1.52.2.8
  diff -u -u -r1.52.2.7 -r1.52.2.8
  --- ap_mmn.h	7 Jan 2004 02:49:46 -0000	1.52.2.7
  +++ ap_mmn.h	12 Jan 2004 15:54:36 -0000	1.52.2.8
  @@ -116,6 +116,7 @@
    * 20020903.4 (2.0.47-dev) add ap_is_recursion_limit_exceeded()
    * 20020903.5 (2.0.49-dev) add ap_escape_errorlog_item()
    * 20020903.6 (2.0.49-dev) add insert_error_filter hook
  + * 20020903.7 (2.0.49-dev) added XHTML Doctypes
    */
   
   #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
  @@ -123,7 +124,7 @@
   #ifndef MODULE_MAGIC_NUMBER_MAJOR
   #define MODULE_MAGIC_NUMBER_MAJOR 20020903
   #endif
  -#define MODULE_MAGIC_NUMBER_MINOR 6                     /* 0...n */
  +#define MODULE_MAGIC_NUMBER_MINOR 7                     /* 0...n */
   
   /**
    * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
  
  
  
  1.191.2.10 +15 -0     httpd-2.0/include/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/httpd.h,v
  retrieving revision 1.191.2.9
  retrieving revision 1.191.2.10
  diff -u -u -r1.191.2.9 -r1.191.2.10
  --- httpd.h	1 Jan 2004 13:30:37 -0000	1.191.2.9
  +++ httpd.h	12 Jan 2004 15:54:36 -0000	1.191.2.10
  @@ -280,6 +280,21 @@
   #define DOCTYPE_HTML_4_0F "<!DOCTYPE HTML PUBLIC \"-//W3C//" \
                             "DTD HTML 4.0 Frameset//EN\"\n" \
                             "\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
  +/** XHTML 1.0 Strict Doctype */
  +#define DOCTYPE_XHTML_1_0S "<!DOCTYPE html PUBLIC \"-//W3C//" \
  +                           "DTD XHTML 1.0 Strict//EN\"\n" \
  +                           "\"http://www.w3.org/TR/xhtml1/DTD/" \
  +                           "xhtml1-strict.dtd\">\n"
  +/** XHTML 1.0 Transitional Doctype */
  +#define DOCTYPE_XHTML_1_0T "<!DOCTYPE html PUBLIC \"-//W3C//" \
  +                           "DTD XHTML 1.0 Transitional//EN\"\n" \
  +                           "\"http://www.w3.org/TR/xhtml1/DTD/" \
  +                           "xhtml1-transitional.dtd\">\n"
  +/** XHTML 1.0 Frameset Doctype */
  +#define DOCTYPE_XHTML_1_0F "<!DOCTYPE html PUBLIC \"-//W3C//" \
  +                           "DTD XHTML 1.0 Frameset//EN\"\n" \
  +                           "\"http://www.w3.org/TR/xhtml1/DTD/" \
  +                           "xhtml1-frameset.dtd\">"
   
   /** Internal representation for a HTTP protocol number, e.g., HTTP/1.1 */
   
  
  
  
  No                   revision
  No                   revision
  1.112.2.13 +44 -14    httpd-2.0/modules/generators/mod_autoindex.c
  
  Index: mod_autoindex.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/generators/mod_autoindex.c,v
  retrieving revision 1.112.2.12
  retrieving revision 1.112.2.13
  diff -u -u -r1.112.2.12 -r1.112.2.13
  --- mod_autoindex.c	8 Jan 2004 20:56:18 -0000	1.112.2.12
  +++ mod_autoindex.c	12 Jan 2004 15:54:36 -0000	1.112.2.13
  @@ -111,6 +111,7 @@
   #define TABLE_INDEXING      (1 << 14)
   #define IGNORE_CLIENT       (1 << 15)
   #define IGNORE_CASE         (1 << 16)
  +#define EMIT_XHTML          (1 << 17)
   
   #define K_NOADJUST 0
   #define K_ADJUST 1
  @@ -190,9 +191,9 @@
    * We include the DOCTYPE because we may be using features therefrom (i.e.,
    * HEIGHT and WIDTH attributes on the icons if we're FancyIndexing).
    */
  -static void emit_preamble(request_rec *r, char *title)
  +static void emit_preamble(request_rec *r, int xhtml, const char *title)
   {
  -    ap_rvputs(r, DOCTYPE_HTML_3_2,
  +    ap_rvputs(r, xhtml ? DOCTYPE_XHTML_1_0T : DOCTYPE_HTML_3_2,
                 "<html>\n <head>\n  <title>Index of ", title,
                 "</title>\n </head>\n <body>\n", NULL);
   }
  @@ -411,6 +412,9 @@
           else if (!strcasecmp(w, "VersionSort")) {
               option = VERSION_SORT;
           }
  +        else if (!strcasecmp(w, "XHTML")) {
  +            option = EMIT_XHTML;
  +        }
           else if (!strcasecmp(w, "None")) {
               if (action != '\0') {
                   return "Cannot combine '+' or '-' with 'None' keyword";
  @@ -989,7 +993,7 @@
    * oh well.
    */
   static void emit_head(request_rec *r, char *header_fname, int suppress_amble,
  -                      char *title)
  +                      int emit_xhtml, char *title)
   {
       apr_table_t *hdrs = r->headers_in;
       apr_file_t *f = NULL;
  @@ -1032,7 +1036,7 @@
                   emit_H1 = 0;
   
                   if (! suppress_amble) {
  -                    emit_preamble(r, title);
  +                    emit_preamble(r, emit_xhtml, title);
                   }
                   /* This is a hack, but I can't find any better way to do this.
                    * The problem is that we have already created the sub-request,
  @@ -1070,7 +1074,7 @@
                    */
                   if (apr_file_open(&f, rr->filename, APR_READ,
                                     APR_OS_DEFAULT, r->pool) == APR_SUCCESS) {
  -                    emit_preamble(r, title);
  +                    emit_preamble(r, emit_xhtml, title);
                       emit_amble = 0;
                       do_emit_plain(r, f);
                       apr_file_close(f);
  @@ -1092,7 +1096,7 @@
       }
   
       if (emit_amble) {
  -        emit_preamble(r, title);
  +        emit_preamble(r, emit_xhtml, title);
       }
       if (emit_H1) {
           ap_rvputs(r, "<h1>Index of ", title, "</h1>\n", NULL);
  @@ -1543,7 +1547,11 @@
                   if (d->icon_height) {
                       ap_rprintf(r, " height=\"%d\"", d->icon_height);
                   }
  -                ap_rputs(" /></th>", r);
  +
  +                if (autoindex_opts & EMIT_XHTML) {
  +                    ap_rputs(" /", r);
  +                }
  +                ap_rputs("></th>", r);
               }
               else {
                   ap_rputs("&nbsp;</th>", r);
  @@ -1575,7 +1583,8 @@
           if (!(autoindex_opts & SUPPRESS_RULES)) {
               breakrow = apr_psprintf(r->pool,
                                       "<tr><th colspan=\"%d\">"
  -                                    "<hr /></th></tr>\n", cols);
  +                                    "<hr%s></th></tr>\n", cols,
  +                                    (autoindex_opts & EMIT_XHTML) ? " /" : "");
           }
           ap_rvputs(r, "</th></tr>", breakrow, NULL);
       }
  @@ -1591,7 +1600,11 @@
                   if (d->icon_height) {
                       ap_rprintf(r, " height=\"%d\"", d->icon_height);
                   }
  -                ap_rputs(" /> ", r);
  +
  +                if (autoindex_opts & EMIT_XHTML) {
  +                    ap_rputs(" /", r);
  +                }
  +                ap_rputs("> ", r);
               }
               else {
                   ap_rputs("      ", r);
  @@ -1619,7 +1632,11 @@
                         colargs, static_columns);
           }
           if (!(autoindex_opts & SUPPRESS_RULES)) {
  -            ap_rputs("<hr />", r);
  +            ap_rputs("<hr", r);
  +            if (autoindex_opts & EMIT_XHTML) {
  +                ap_rputs(" /", r);
  +            }
  +            ap_rputs(">", r);
           }
           else {
               ap_rputc('\n', r);
  @@ -1665,7 +1682,11 @@
                       if (d->icon_height) {
                           ap_rprintf(r, " height=\"%d\"", d->icon_height);
                       }
  -                    ap_rputs(" />", r);
  +
  +                    if (autoindex_opts & EMIT_XHTML) {
  +                        ap_rputs(" /", r);
  +                    }
  +                    ap_rputs(">", r);
                   }
                   else {
                       ap_rputs("&nbsp;", r);
  @@ -1751,7 +1772,11 @@
                       if (d->icon_height) {
                           ap_rprintf(r, " height=\"%d\"", d->icon_height);
                       }
  -                    ap_rputs(" />", r);
  +
  +                    if (autoindex_opts & EMIT_XHTML) {
  +                        ap_rputs(" /", r);
  +                    }
  +                    ap_rputs(">", r);
                   }
                   else {
                       ap_rputs("     ", r);
  @@ -1818,7 +1843,11 @@
       }
       else if (autoindex_opts & FANCY_INDEXING) {
           if (!(autoindex_opts & SUPPRESS_RULES)) {
  -            ap_rputs("<hr /></pre>\n", r);
  +            ap_rputs("<hr", r);
  +            if (autoindex_opts & EMIT_XHTML) {
  +                ap_rputs(" /", r);
  +            }
  +            ap_rputs("></pre>\n", r);
           }
           else {
               ap_rputs("</pre>\n", r);
  @@ -2095,7 +2124,8 @@
       }
   
       emit_head(r, find_header(autoindex_conf, r),
  -              autoindex_opts & SUPPRESS_PREAMBLE, title_name);
  +              autoindex_opts & SUPPRESS_PREAMBLE,
  +              autoindex_opts & EMIT_XHTML, title_name);
   
       /*
        * Since we don't know how many dir. entries there are, put them into a
  
  
  

Mime
View raw message