httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 45405] Allow binding port to be set for individual workers for proxy requests
Date Wed, 16 Jul 2008 18:12:39 GMT

D. Stussy <> changed:

           What    |Removed                     |Added
                 CC|                            |apache+bugreports@kd6lvw.amp
                   |                            |

--- Comment #1 from D. Stussy <>  2008-07-16 11:12:38
PST ---

1)  In this version, you're still defining variables inside the for(;;)
statement.  As noted in the parent enhancement 44806, that is not a portable
construction for some compilers.  Please pull the declarations out of the for()
statements.  Otherwise, except for a small change in which structure the data
is stored in, the code looks almost identical to our prior solution, so it
should work without additional extensive testing.

2)  My thought was to have BOTH a virtual-host-wide "ProxyBindAddress" and an
individual setting for a proxy worker if separately defined.  Therefore, when a
worker is first initialized, shouldn't it copy the bind-address info from the
"conf" structure to the "worker" structure (which maybe subsequently
overwritten by a worker-specific directive)?  Simply copying the data from one
structure to the other should suffice, INCLUDING copying the pointer - as
"conf" should never be released as long as it has a "worker" structure under
it.  I make one assumption:  That at least one "worker" structure will always
exist for each "conf" structure (I have not confirmed that in the code).

As such:
  changes to proxy_util.c would be as per this patch, not 44806.
  changes to mod_proxy.c from both would be combined into a parsing routine
     passes the character string and addresses for 3 parameters.  The fourth
     parameter, "...->bindopt_set" could be determined from the return code of
     the parsing subroutine (char *; NULL == success, otherwise error message).
     There would be minimal code changes to both line ranges for the TWO calls
     to the parser, one for "ProxyBindAddress" and one for "ProxySet ...
   + Also, a "new_worker()" routine needs to copy data from "conf" to "worker".
  changes to mod_proxy.h would have BOTH changes, one from each enhancement.

for mod_proxy.c:
char *parse_bind_address(char *addr, apr_sockaddr_t **bind_addr, 
     apr_port_t *bind_port, apr_port_t *bind_range)
move the parsing code into here - adjusting as necessary.

from main configuration - ProxyBindAddress()
set_proxy_bindaddr(cmd_parms *parms, void *dummy, const char *addr)
+    char *range, *host, *scope_id;
+    apr_port_t port;
+    int r = 0;
+    proxy_server_conf *psf =
+    ap_get_module_config(parms->server->module_config, &proxy_module);
++   char *rc;
++   rc = parse_bind_address( addr, &psf->bind_addr, &psf->bind_port,
++   if (rc == NULL) {
++       psf->bind_idx = 0;
++       psf->bindopt_set = 1;
++   } 
+    return rc;

from worker configuration - ProxySet() ... bind=
+    else if (!strcasecmp(key, "bind")) {
++       char *rc;
++       rc = parse_bind_address( (char*)val, &worker->bind_addr,
++                                &worker->bind_port, &worker->bind_range)
++       if (rc == NULL) {
++           worker->bind_idx = 0;
++           worker->bindopt_set = 1;
++       }
++       return rc;
+    }
     else {
         return "unknown Worker parameter";

Configuration notes:
 - Workers defined via ProxySet BEFORE ProxyBindAddress would inherit the
default settings of no info (unspecified address, port 0, range 1).
 - Workers defined via ProxySet AFTER ProxyBindAddress should inherit the
ProxyBindAddress settings in effect for its scope (main config, virtual host,

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message