You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ni...@apache.org on 2009/12/22 00:43:50 UTC

svn commit: r893035 - in /httpd/httpd/trunk: CHANGES modules/generators/mod_autoindex.c

Author: niq
Date: Mon Dec 21 23:43:50 2009
New Revision: 893035

URL: http://svn.apache.org/viewvc?rev=893035&view=rev
Log:
mod_autoindex: support XHTML as equivalent to HTML in
IndexOptions, ScanHTMLTitles, ReadmeName, HeaderName
PR 48416 [Dmitry Bakshaev <dab18 izhnet.ru>, Nick Kew]


Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/modules/generators/mod_autoindex.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=893035&r1=893034&r2=893035&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Mon Dec 21 23:43:50 2009
@@ -26,6 +26,10 @@
      check at startup.
      PR 41887 [Jan van den Berg <janvdberg gmail.com>]
 
+  *) mod_autoindex: support XHTML as equivalent to HTML in IndexOptions,
+                    ScanHTMLTitles, ReadmeName, HeaderName
+     PR 48416 [Dmitry Bakshaev <dab18 izhnet.ru>, Nick Kew]
+
 Changes with Apache 2.3.4
 
   *) Replace AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex,

Modified: httpd/httpd/trunk/modules/generators/mod_autoindex.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/mod_autoindex.c?rev=893035&r1=893034&r2=893035&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/mod_autoindex.c (original)
+++ httpd/httpd/trunk/modules/generators/mod_autoindex.c Mon Dec 21 23:43:50 2009
@@ -149,6 +149,14 @@
 #define BY_TYPE &c_by_type
 #define BY_PATH &c_by_path
 
+static inline int response_is_html(request_rec *r)
+{
+    char *ctype = ap_field_noparam(r->pool, r->content_type);
+    ap_str_tolower(ctype);
+    return !strcmp(ctype, "text/html")
+        || !strcmp(ctype, "application/xhtml+xml");
+}
+
 /*
  * This routine puts the standard HTML header at the top of the index page.
  * We include the DOCTYPE because we may be using features therefrom (i.e.,
@@ -1013,8 +1021,7 @@
          * SSIs.
          */
         if (rr->content_type != NULL) {
-            if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type),
-                            "text/html")) {
+            if (response_is_html(rr)) {
                 ap_filter_t *f;
                /* Hope everything will work... */
                 emit_amble = 0;
@@ -1124,8 +1131,7 @@
          * SSIs.
          */
         if (rr->content_type != NULL) {
-            if (!strcasecmp(ap_field_noparam(r->pool, rr->content_type),
-                            "text/html")) {
+            if (response_is_html(rr)) {
                 ap_filter_t *f;
                 for (f=rr->output_filters;
                      f->frec != ap_subreq_core_filter_handle; f = f->next);
@@ -1175,8 +1181,7 @@
         return NULL;
     }
     if ((r->content_type != NULL)
-        && (!strcasecmp(ap_field_noparam(r->pool, r->content_type),
-                        "text/html")
+        && (response_is_html(r)
             || !strcmp(r->content_type, INCLUDES_MAGIC_TYPE))
         && !r->content_encoding) {
         if (apr_file_open(&thefile, r->filename, APR_READ,