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
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:
* @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,
}
/* 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)) {