]> granicus.if.org Git - apache/commitdiff
Merge r1592511, r1592514 from trunk:
authorJim Jagielski <jim@apache.org>
Fri, 30 May 2014 13:51:39 +0000 (13:51 +0000)
committerJim Jagielski <jim@apache.org>
Fri, 30 May 2014 13:51:39 +0000 (13:51 +0000)
reformat only (get rid of unnecessary block scope)

Clarify an existing requirement of the server_portstr parameter
to ap_proxy_determine_connection(): it must be a buffer of at
least one byte in size.

(And don't bother with using strcpy in order to zap a string.)

Submitted by: trawick
Reviewed/backported by: jim

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

STATUS
modules/proxy/mod_proxy.h
modules/proxy/proxy_util.c

diff --git a/STATUS b/STATUS
index c33a3a9b87047494b0abc3f2ffb1bd4508e28389..b4e291e2a9cd287bd33d3f8c68314be295cb233b 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -100,17 +100,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * minor proxy_util cleanups:
-     . get rid of unnecessary block scope
-     . Clarify an existing requirement of the server_portstr parameter
-       to ap_proxy_determine_connection(): it must be a buffer of at
-       least one byte in size.  (And don't bother with using strcpy in
-       order to zap a string.)
-     trunk patches: http://svn.apache.org/viewvc?view=revision&revision=r1592511
-                    http://svn.apache.org/viewvc?view=revision&revision=r1592514
-     2.4.x patches: trunk patches work
-     +1: trawick, ylavic, jim
-
 
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
index 585ace89eb001eb683284565f7d99c2d7ed7915e..4ead22e7018972b1859c434f5f7295536a4c2449 100644 (file)
@@ -797,8 +797,9 @@ PROXY_DECLARE(int) ap_proxy_post_request(proxy_worker *worker,
  * @param url     request url
  * @param proxyname are we connecting directly or via a proxy
  * @param proxyport proxy host port
- * @param server_portstr Via headers server port
- * @param server_portstr_size size of the server_portstr buffer
+ * @param server_portstr Via headers server port, must be non-NULL
+ * @param server_portstr_size size of the server_portstr buffer; must
+ * be at least one, even if the protocol doesn't use this
  * @return         OK or HTTP_XXX error
  */
 PROXY_DECLARE(int) ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
index 3dd12ca32921a77950642dd57d110d181b185caf..a81848c9dafa0782bb028a9d51701b8102341cb1 100644 (file)
@@ -2329,16 +2329,16 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
     }
 
     /* Get the server port for the Via headers */
-    {
-        server_port = ap_get_server_port(r);
-        if (ap_is_default_port(server_port, r)) {
-            strcpy(server_portstr,"");
-        }
-        else {
-            apr_snprintf(server_portstr, server_portstr_size, ":%d",
-                         server_port);
-        }
+    server_port = ap_get_server_port(r);
+    AP_DEBUG_ASSERT(server_portstr_size > 0);
+    if (ap_is_default_port(server_port, r)) {
+        server_portstr[0] = '\0';
     }
+    else {
+        apr_snprintf(server_portstr, server_portstr_size, ":%d",
+                     server_port);
+    }
+
     /* check if ProxyBlock directive on this host */
     if (OK != ap_proxy_checkproxyblock2(r, conf, uri->hostname, 
                                        proxyname ? NULL : conn->addr)) {