Commit 182e5dfe authored by Nick Kew's avatar Nick Kew
Browse files

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
parent b69a9117
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
                                                         -*- 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.
     [Yann Ylavic]
+2 −7
Original line number Diff line number Diff line
@@ -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:
+18 −18
Original line number Diff line number Diff line
@@ -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,29 +373,23 @@ 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)
            return;
    
    }
    else if ((ctx->cfg->doctype == fpi_html)
             || (ctx->cfg->doctype == fpi_xhtml)) {
        enforce = 1;
        /* enforce html legacy */
        if (!desc) {
            return;
        }
    }
    if (!desc && enforce) {
        if (!desc || desc->depr) {
            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)) {
        enforce = 2;
    }
    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;
        }
        enforce = 1;
    }
#ifdef HAVE_STACK
    descp = apr_array_push(ctx->stack);
    *descp = desc;
@@ -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')))