]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1744458, r1744459 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 13 Jun 2016 13:00:09 +0000 (13:00 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 13 Jun 2016 13:00:09 +0000 (13:00 +0000)
Avoid memory allocation before making sure that this handler can handle the URL

Avoid memory allocation before making sure that this handler can handle the URL
Submitted by: jailletc36
Reviewed/backported by: jim

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

STATUS
modules/proxy/mod_proxy_fcgi.c
modules/proxy/mod_proxy_scgi.c

diff --git a/STATUS b/STATUS
index 3d7f4f8ca1bfb4208e38d11647a2ab0b1d7de6d7..c39acba8aa60b36d0368170c4ff83736f3a6b407 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -114,13 +114,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-  *) mod_proxy_(fcgi|scgi): save a few bytes in the request pool when this
-     handler is not able to process the URL.
-     trunk patch: http://svn.apache.org/r1744458
-                  http://svn.apache.org/r1744459
-     2.4.x patch: trunk works
-     +1: jailletc36, jim, trawick
-
   *) http: Add 451 status code
      trunk patch: http://svn.apache.org/r1730723
      2.4.x: trunk works
index 90c63c3bb5d003e7d875c5dc6ce429443048484d..43c243e41493670f4608a7cfdf5c0dd62a0706c9 100644 (file)
@@ -876,17 +876,17 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
     char server_portstr[32];
     conn_rec *origin = NULL;
     proxy_conn_rec *backend = NULL;
+    apr_uri_t *uri;
 
     proxy_dir_conf *dconf = ap_get_module_config(r->per_dir_config,
                                                  &proxy_module);
 
     apr_pool_t *p = r->pool;
 
-    apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri));
 
     ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01076)
                   "url: %s proxyname: %s proxyport: %d",
-                 url, proxyname, proxyport);
+                  url, proxyname, proxyport);
 
     if (strncasecmp(url, "fcgi:", 5) != 0) {
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01077) "declining URL %s", url);
@@ -909,6 +909,7 @@ static int proxy_fcgi_handler(request_rec *r, proxy_worker *worker,
     backend->is_ssl = 0;
 
     /* Step One: Determine Who To Connect To */
+    uri = apr_palloc(p, sizeof(*uri));
     status = ap_proxy_determine_connection(p, r, conf, worker, backend,
                                            uri, &url, proxyname, proxyport,
                                            server_portstr,
index 2cbe8483f34099ecd7a3f7df666d956fe2d93f1f..cede817a7eac49c25c58e3785a5155fce9c33d48 100644 (file)
@@ -509,7 +509,7 @@ static int scgi_request_status(int *status, request_rec *r)
                     *status = HTTP_INTERNAL_SERVER_ERROR;
                     return *status;
                 }
-            } while(0);
+            } while (0);
 
             return OK;
             /* break; */
@@ -530,7 +530,7 @@ static int scgi_handler(request_rec *r, proxy_worker *worker,
     int status;
     proxy_conn_rec *backend = NULL;
     apr_pool_t *p = r->pool;
-    apr_uri_t *uri = apr_palloc(r->pool, sizeof(*uri));
+    apr_uri_t *uri;
     char dummy;
 
     if (strncasecmp(url, SCHEME "://", sizeof(SCHEME) + 2)) {
@@ -548,6 +548,7 @@ static int scgi_handler(request_rec *r, proxy_worker *worker,
     backend->is_ssl = 0;
 
     /* Step One: Determine Who To Connect To */
+    uri = apr_palloc(p, sizeof(*uri));
     status = ap_proxy_determine_connection(p, r, conf, worker, backend,
                                            uri, &url, proxyname, proxyport,
                                            &dummy, 1);