]> granicus.if.org Git - apache/commitdiff
Backport mod_proxy_html doctype fixes.
authorNick Kew <niq@apache.org>
Fri, 22 Dec 2017 22:52:21 +0000 (22:52 +0000)
committerNick Kew <niq@apache.org>
Fri, 22 Dec 2017 22:52:21 +0000 (22:52 +0000)
PR#56457 included.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1819098 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/filters/mod_proxy_html.c

diff --git a/CHANGES b/CHANGES
index 95a7dda78e35bdfdd5d7182a8d2878b59cc8ddf9..d1851c05f5146b6b1fbdc0d380cfd415db832ff7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,14 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.4.30
+  *) mod_proxy_html: process parsed comments immediately. 
+     Fixes bug (seen in the wild when used with IBM's HTTPD bundle)
+     where parsed comments may be lost. [Nick Kew]
+
+  *) mod_proxy_html: introduce doctype for HTML 5 [Nick Kew]
+
+  *) mod_proxy_html: fix typo-bug processing "strict" vs "transitional"
+     HTML/XHTML.  PR 56457  [Nick Kew]
 
   *) mpm_event: avoid a very unlikely race condition between the listener and
      the workers when the latter fails to add a connection to the pollset.
diff --git a/STATUS b/STATUS
index f08491a7e46c7f80df228cd749a278c033c73064..6b313d3adb875856feccd0838fa2c5b9a1527240 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -123,13 +123,8 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
      trunk revisions: 1804530,1804531,1805186,1806939,1807232,1808122
      2.4.x patch: https://svn.apache.org/repos/asf/httpd/httpd/patches/2.4.x/mod_ssl_minimal_md.diff
      +1: icing, jorton, jim
-
-  *) mod_proxy_html: Add HTML5 FPI, fix typo in handling legacy FPIs,
-     process parsed comments immediately.  Fix PR 56457
-     trunk patch: http://svn.apache.org/r1442409
-                  http://svn.apache.org/r1816458
-     2.4.x patch: svn merge -c r1442409,r1816458 ^/httpd/httpd/trunk .
-     +1: niq, covener, elukey
+     [niq: I was about to backport along with the mod_proxy_html accepted
+      patch, but I see this is on hold pending mod_md.h]
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
index ee6a7210638e75712109a8936a53537c56274262..569fa137753af73c2345f0ff21a33f797abc34c9 100644 (file)
@@ -126,6 +126,7 @@ static const char *const fpi_xhtml =
         "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
 static const char *const fpi_xhtml_legacy =
         "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
+static const char *const fpi_html5 = "<!DOCTYPE html>\n";
 static const char *const html_etag = ">";
 static const char *const xhtml_etag = " />";
 /*#define DEFAULT_DOCTYPE fpi_html */
@@ -309,6 +310,7 @@ static void pcomment(void *ctxt, const xmlChar *uchars)
         ap_fputs(ctx->f->next, ctx->bb, "<!--");
         AP_fwrite(ctx, chars, strlen(chars), 1);
         ap_fputs(ctx->f->next, ctx->bb, "-->");
+        dump_content(ctx);
     }
 }
 static void pendElement(void *ctxt, const xmlChar *uname)
@@ -323,8 +325,8 @@ static void pendElement(void *ctxt, const xmlChar *uname)
             return;
     
     }
-    else if ((ctx->cfg->doctype == fpi_html)
-             || (ctx->cfg->doctype == fpi_xhtml)) {
+    else if ((ctx->cfg->doctype == fpi_html_legacy)
+             || (ctx->cfg->doctype == fpi_xhtml_legacy)) {
         /* enforce html legacy */
         if (!desc)
             return;
@@ -371,28 +373,22 @@ static void pstartElement(void *ctxt, const xmlChar *uname,
     int enforce = 0;
     if ((ctx->cfg->doctype == fpi_html) || (ctx->cfg->doctype == fpi_xhtml)) {
         /* enforce html */
-        enforce = 2;
-        if (!desc || desc->depr)
+        if (!desc || desc->depr) {
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, ctx->f->r, APLOGNO(01416)
+                          "Bogus HTML element %s dropped", name);
             return;
-    
+        }
+        enforce = 2;
     }
-    else if ((ctx->cfg->doctype == fpi_html)
-             || (ctx->cfg->doctype == fpi_xhtml)) {
-        enforce = 1;
+    else if ((ctx->cfg->doctype == fpi_html_legacy)
+             || (ctx->cfg->doctype == fpi_xhtml_legacy)) {
         /* enforce html legacy */
         if (!desc) {
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, ctx->f->r, APLOGNO(01417)
+                          "Deprecated HTML element %s dropped", name);
             return;
         }
-    }
-    if (!desc && enforce) {
-        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, ctx->f->r, APLOGNO(01416)
-                      "Bogus HTML element %s dropped", name);
-        return;
-    }
-    if (desc && desc->depr && (enforce == 2)) {
-        ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, ctx->f->r, APLOGNO(01417)
-                      "Deprecated HTML element %s dropped", name);
-        return;
+        enforce = 1;
     }
 #ifdef HAVE_STACK
     descp = apr_array_push(ctx->stack);
@@ -1132,6 +1128,10 @@ static const char *set_doctype(cmd_parms *cmd, void *CFG,
         else
             cfg->doctype = fpi_html;
     }
+    else if (!strcasecmp(t, "html5")) {
+        cfg->etag = html_etag;
+        cfg->doctype = fpi_html5;
+    }
     else {
         cfg->doctype = apr_pstrdup(cmd->pool, t);
         if (l && ((l[0] == 'x') || (l[0] == 'X')))