]> granicus.if.org Git - apache/commitdiff
Merge r1795834, r1828912, r1830943, r1830944, r1832991 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 2 Jul 2018 12:49:16 +0000 (12:49 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 2 Jul 2018 12:49:16 +0000 (12:49 +0000)
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

STATUS
modules/filters/mod_proxy_html.c
modules/metadata/mod_env.c
modules/proxy/mod_proxy_hcheck.c
modules/ssl/ssl_util.c

diff --git a/STATUS b/STATUS
index 896eb97fa99180413db5601f85381d5a6368959d..6e68548253ea616595d78f6c8650127af86a3868 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -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 ]
index 7658fa3c613f704cc7e54182db96f51c060f344b..ea6bf03c4704e269760b44a04f85414515e9926e 100644 (file)
@@ -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 = "";
         }
index 081ee549f35088c4258785b6fd1d6be01b020c4f..52594e9cf208500fb45e461cd08f10ba2c6fcaee 100644 (file)
@@ -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
index 485fa741414d567704d7f30ea40aadddf500fd00..0265b4ab9791d23b13e5abd15130757fe1c4a6ac 100644 (file)
@@ -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);
index afc64a3ac48844513a5fcf1a396ab550e36487d7..c372044bbb201e79c40bb3dc4b403ade0ff6605a 100644 (file)
 
 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);
 }
 
 /*