On Tue, Nov 11, 2003 at 03:38:31PM +0200, Eli Marmor wrote:
> I wrote:
> 
> > ...
> > And as the original sender hinted by the "Subject" header, it is easy
> > to implement: just "bind()" the required IP into the socket before
> > calling "apr_connect()" (it may require a minor fix in APR, I'm not
> > sure).
> 
> After looking at srclib/apr/network_io/unix/sockets.c and
> srclib/apr/network_io/win32/sockets.c, I believe that the feature
> request is doable, and doesn't require any change in APR, but only in
> files belong to modules/proxy.
> 

Hi,
Because I want to try this feature in next days, I tried to change
the mod_proxy myself. but since I have no experience with mod_proxy
programming at all, I would like you to correct my change or tell 
me if the change can have a bad side effect. my change will bind 
mod_proxy to the  ip address defined in VirtualHost, and it works
here at least.  
The change is only in the proxy_util.c , here is the patch:
____________________________________________
diff -Naur httpd-2.0.48/modules/proxy/proxy_util.c 
httpd-2.0.48-new/modules/proxy/proxy_util.c
--- httpd-2.0.48/modules/proxy/proxy_util.c     2003-11-12 18:20:06.000000000 
+0100
+++ httpd-2.0.48-new/modules/proxy/proxy_util.c 2003-11-13 21:08:31.000000000 
+0100
@@ -1162,6 +1162,8 @@
                                                apr_pool_t *p)
 {
     apr_status_t rv;
+    apr_status_t err;
+    apr_sockaddr_t *vhost_addr;
     int connected = 0;
     int loglevel;

@@ -1181,6 +1183,10 @@
             backend_addr = backend_addr->next;
             continue;
         }
+       
+       err = apr_sockaddr_info_get(&vhost_addr, s->addrs->virthost,
+             APR_UNSPEC, 0, 0, p);
+       apr_socket_bind(*newsock, vhost_addr);

 #if !defined(TPF) && !defined(BEOS)
         if (conf->recv_buffer_size > 0 &&
_____________________________________________


Thanks,
cahya


Reply via email to