Commit 8a63eb9f authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r1795834, r1828912, r1830943, r1830944, r1832991 from trunk:

Remove empty line.

* modules/ssl/ssl_util.c (ssl_util_vhostid): Simplify code,
  no functional change.


Save a few cycles and simlify code.

Use apr_pstrmemdup instead of apr_pstrndup when possible.
Avoid scanning the first 2 bytes when looking for the | delimiter. it is known to be "${".
Avoid comma separated statements, it is not that usual.

Save a few cycles.

Use apr_pstrmemdup instead of apr_pstrndup when possible.

* modules/proxy/mod_proxy_hcheck.c (sctx_t, hc_create_config):
  Remove unused bucket allocator created off pconf.
  Tag the subpool.

Submitted by: jailletc36, jorton, jailletc36, jailletc36, jorton
Reviewed by: jailletc36, covener, jim


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1834844 13f79535-47bb-0310-9956-ffa450edef68
parent 8756f652
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -141,20 +141,6 @@ RELEASE SHOWSTOPPERS:
PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
  [ start all new proposals below, under PATCHES PROPOSED. ]

  *) Easy patches: synch 2.4.x and trunk
     - mod_env: remove an empty line
     - mod_ssl: Simplify code, no functional change
     - mod_proxy_html: Save a few cycles and simplify code
     - mod_proxy_html: Save a few more cycles
     - mod_proxy_hcheck: Remove an unused bucket allocator + tag the subpool
     trunk patch: http://svn.apache.org/r1795834
                  http://svn.apache.org/r1828912
                  http://svn.apache.org/r1830943
                  http://svn.apache.org/r1830944
                  http://svn.apache.org/r1832991
     2.4.x patch: svn merge -c 1795834,1828912,1830943,1830944,1832991 ^/httpd/httpd/trunk . 
     +1: jailletc36, covener, jim


PATCHES PROPOSED TO BACKPORT FROM TRUNK:
  [ New proposals should be added at the end of the list ]
+9 −10
Original line number Diff line number Diff line
@@ -659,7 +659,7 @@ static meta *metafix(request_rec *r, const char *buf, apr_size_t len)
        p = buf+offs+pmatch[1].rm_eo;
        while (!apr_isalpha(*++p));
        for (q = p; apr_isalnum(*q) || (*q == '-'); ++q);
        header = apr_pstrndup(r->pool, p, q-p);
        header = apr_pstrmemdup(r->pool, p, q-p);
        if (strncasecmp(header, "Content-", 8)) {
            /* find content=... string */
            p = apr_strmatch(seek_content, buf+offs+pmatch[0].rm_so,
@@ -683,7 +683,7 @@ static meta *metafix(request_rec *r, const char *buf, apr_size_t len)
                    } else {
                        for (q = p; *q && !apr_isspace(*q) && (*q != '>'); ++q);
                    }
                    content = apr_pstrndup(r->pool, p, q-p);
                    content = apr_pstrmemdup(r->pool, p, q-p);
                    break;
                }
            }
@@ -716,32 +716,31 @@ static const char *interpolate_vars(request_rec *r, const char *str)
    const char *replacement;
    const char *var;
    for (;;) {
        start = str;
        if (start = ap_strstr_c(start, "${"), start == NULL)
        if ((start = ap_strstr_c(str, "${")) == NULL)
            break;

        if (end = ap_strchr_c(start+2, '}'), end == NULL)
        if ((end = ap_strchr_c(start+2, '}')) == NULL)
            break;

        delim = ap_strchr_c(start, '|');
        delim = ap_strchr_c(start+2, '|');

        /* Restrict delim to ${...} */
        if (delim && delim >= end) {
            delim = NULL;
        }

        before = apr_pstrndup(r->pool, str, start-str);
        before = apr_pstrmemdup(r->pool, str, start-str);
        after = end+1;
        if (delim) {
            var = apr_pstrndup(r->pool, start+2, delim-start-2);
            var = apr_pstrmemdup(r->pool, start+2, delim-start-2);
        }
        else {
            var = apr_pstrndup(r->pool, start+2, end-start-2);
            var = apr_pstrmemdup(r->pool, start+2, end-start-2);
        }
        replacement = apr_table_get(r->subprocess_env, var);
        if (!replacement) {
            if (delim)
                replacement = apr_pstrndup(r->pool, delim+1, end-delim-1);
                replacement = apr_pstrmemdup(r->pool, delim+1, end-delim-1);
            else
                replacement = "";
        }
+0 −1
Original line number Diff line number Diff line
@@ -121,7 +121,6 @@ static const char *add_env_module_vars_set(cmd_parms *cmd, void *sconf_,
        ap_log_error(APLOG_MARK, APLOG_WARNING, 0, cmd->server, APLOGNO(10032)
                     "Spurious usage of '=' in an environment variable name. "
                     "'%s %s %s' expected instead?", cmd->cmd->name, env, plast);
    
    }

    /* name is mandatory, value is optional.  no value means
+1 −2
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ typedef struct {

typedef struct {
    apr_pool_t *p;
    apr_bucket_alloc_t *ba;
    apr_array_header_t *templates;
    apr_table_t *conditions;
    apr_hash_t *hcworkers;
@@ -81,7 +80,7 @@ static void *hc_create_config(apr_pool_t *p, server_rec *s)
    sctx_t *ctx = apr_pcalloc(p, sizeof(sctx_t));
    ctx->s = s;
    apr_pool_create(&ctx->p, p);
    ctx->ba = apr_bucket_alloc_create(p);
    apr_pool_tag(ctx->p, "proxy_hcheck");
    ctx->templates = apr_array_make(p, 10, sizeof(hc_template_t));
    ctx->conditions = apr_table_make(p, 10);
    ctx->hcworkers = apr_hash_make(p);
+3 −9
Original line number Diff line number Diff line
@@ -41,23 +41,17 @@

char *ssl_util_vhostid(apr_pool_t *p, server_rec *s)
{
    char *id;
    SSLSrvConfigRec *sc;
    char *host;
    apr_port_t port;

    host = s->server_hostname;
    if (s->port != 0)
        port = s->port;
    else {
        sc = mySrvConfig(s);
        if (sc->enabled == TRUE)
            port = DEFAULT_HTTPS_PORT;
        else
            port = DEFAULT_HTTP_PORT;
        port = sc->enabled == TRUE ? DEFAULT_HTTPS_PORT : DEFAULT_HTTP_PORT;
    }
    id = apr_psprintf(p, "%s:%lu", host, (unsigned long)port);
    return id;

    return apr_psprintf(p, "%s:%lu", s->server_hostname, (unsigned long)port);
}

/*