]> granicus.if.org Git - apache/commitdiff
mod_autoindex: support XHTML as equivalent to HTML in
authorNick Kew <niq@apache.org>
Mon, 21 Dec 2009 23:43:50 +0000 (23:43 +0000)
committerNick Kew <niq@apache.org>
Mon, 21 Dec 2009 23:43:50 +0000 (23:43 +0000)
IndexOptions, ScanHTMLTitles, ReadmeName, HeaderName
PR 48416 [Dmitry Bakshaev <dab18 izhnet.ru>, Nick Kew]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@893035 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/generators/mod_autoindex.c

diff --git a/CHANGES b/CHANGES
index 27deb020bdb4e693c729b325c3adde146f89018d..59942cda2149971ab9f9a0bf25c41b3e066876a5 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -26,6 +26,10 @@ Changes with Apache 2.3.5
      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,
index ea0e3f99fb01b446d18bf1868eb61fdb2da5a5d8..7756f9e4150d15279d9bf5dc9d3db1e362ce0019 100644 (file)
@@ -149,6 +149,14 @@ static char c_by_encoding, c_by_type, c_by_path;
 #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 @@ static void emit_head(request_rec *r, char *header_fname, int suppress_amble,
          * 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 @@ static void emit_tail(request_rec *r, char *readme_fname, int suppress_amble)
          * 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 @@ static char *find_title(request_rec *r)
         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,