diff options
author | Nick Kew <niq@apache.org> | 2017-12-22 22:52:21 +0000 |
---|---|---|
committer | Nick Kew <niq@apache.org> | 2017-12-22 22:52:21 +0000 |
commit | 6191f188958268b6cd30a1724e502d7b2f34fa7d (patch) | |
tree | 382da1b53378128e0d9be40edb42e3af97239bb6 | |
parent | 13baa1a4d5015c2c4ff7f60614646918bec7690e (diff) | |
download | httpd-6191f188958268b6cd30a1724e502d7b2f34fa7d.tar.gz |
Backport mod_proxy_html doctype fixes.
PR#56457 included.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1819098 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | CHANGES | 9 | ||||
-rw-r--r-- | STATUS | 9 | ||||
-rw-r--r-- | modules/filters/mod_proxy_html.c | 36 |
3 files changed, 29 insertions, 25 deletions
@@ -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. @@ -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: diff --git a/modules/filters/mod_proxy_html.c b/modules/filters/mod_proxy_html.c index ee6a721063..569fa13775 100644 --- a/modules/filters/mod_proxy_html.c +++ b/modules/filters/mod_proxy_html.c @@ -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'))) |