From: Jim Jagielski Date: Mon, 13 Jun 2016 13:00:09 +0000 (+0000) Subject: Merge r1744458, r1744459 from trunk: X-Git-Tag: 2.4.21~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ab82024407189d6294046e88fc7f480ad95d88d;p=thirdparty%2Fapache%2Fhttpd.git Merge r1744458, r1744459 from trunk: 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 --- diff --git a/STATUS b/STATUS index 3d7f4f8ca1b..c39acba8aa6 100644 --- 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 diff --git a/modules/proxy/mod_proxy_fcgi.c b/modules/proxy/mod_proxy_fcgi.c index 90c63c3bb5d..43c243e4149 100644 --- a/modules/proxy/mod_proxy_fcgi.c +++ b/modules/proxy/mod_proxy_fcgi.c @@ -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, diff --git a/modules/proxy/mod_proxy_scgi.c b/modules/proxy/mod_proxy_scgi.c index 2cbe8483f34..cede817a7ea 100644 --- a/modules/proxy/mod_proxy_scgi.c +++ b/modules/proxy/mod_proxy_scgi.c @@ -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);