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 Sun, 02 Nov 2003 20:37:04 GMT
nd          2003/11/02 12:37:04

  Modified:    .        CHANGES
               include  ap_mmn.h httpd.h
               modules/generators mod_autoindex.c
  Log:
  - add XHTML doctypes to httpd.h
  - fix the (x)html output of mod_autoindex to be consistent
    and make it configurable to emit either HTML or XHTML
  
  PR: 23747
  
  Revision  Changes    Path
  1.1308    +6 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.1307
  retrieving revision 1.1308
  diff -u -u -r1.1307 -r1.1308
  --- CHANGES	2 Nov 2003 00:36:08 -0000	1.1307
  +++ CHANGES	2 Nov 2003 20:37:03 -0000	1.1308
  @@ -2,6 +2,12 @@
   
     [Remove entries to the current 2.0 section below, when backported]
   
  +  *) 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_setenvif: Fix the regex optimizer, which under circumstances
        treated the supplied regex as literal string. PR 24219.
        [André Malo]
  
  
  
  1.60      +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.59
  retrieving revision 1.60
  diff -u -u -r1.59 -r1.60
  --- ap_mmn.h	21 Aug 2003 22:12:07 -0000	1.59
  +++ ap_mmn.h	2 Nov 2003 20:37:03 -0000	1.60
  @@ -116,6 +116,7 @@
    * 20030213.1 (2.1.0-dev) changed log_writer optional fn's to return previous
    *                        handler
    * 20030821 (2.1.0-dev) bumped mod_include's entire API
  + * 20030821.1 (2.1.0-dev) added XHTML doctypes
    */
   
   #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
  @@ -123,7 +124,7 @@
   #ifndef MODULE_MAGIC_NUMBER_MAJOR
   #define MODULE_MAGIC_NUMBER_MAJOR 20030821
   #endif
  -#define MODULE_MAGIC_NUMBER_MINOR 0                     /* 0...n */
  +#define MODULE_MAGIC_NUMBER_MINOR 1                     /* 0...n */
   
   /**
    * Determine if the server's current MODULE_MAGIC_NUMBER is at least a
  
  
  
  1.201     +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.200
  retrieving revision 1.201
  diff -u -u -r1.200 -r1.201
  --- httpd.h	24 Oct 2003 16:20:27 -0000	1.200
  +++ httpd.h	2 Nov 2003 20:37:03 -0000	1.201
  @@ -275,6 +275,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 */
   
  
  
  
  1.124     +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.123
  retrieving revision 1.124
  diff -u -u -r1.123 -r1.124
  --- mod_autoindex.c	1 Nov 2003 23:00:25 -0000	1.123
  +++ mod_autoindex.c	2 Nov 2003 20:37:04 -0000	1.124
  @@ -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);
  @@ -1545,7 +1549,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);
  @@ -1577,7 +1585,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);
       }
  @@ -1593,7 +1602,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);
  @@ -1621,7 +1634,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);
  @@ -1667,7 +1684,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);
  @@ -1753,7 +1774,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);
  @@ -1820,7 +1845,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);
  @@ -2111,7 +2140,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