diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2004-04-27 18:53:14 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2004-04-27 18:53:14 +0000 |
commit | 18df4910a43e8f1b0d9d10df37236fabf0ba8508 (patch) | |
tree | ac5ab56ac77e8c7325cbde33c2b7e7864ead25ea /src/conns.c | |
parent | 3b961ec66bdcf892c14045685f533febe3386ffb (diff) |
Added the "BindSame" configure directive from Oswald Buddenhagen.
This allows tinyproxy to respond to a request bound to the same
interface that the request came in on. As Oswald explains:
"attached is a patch that adds the BindSame option. it causes
binding an outgoing connection to the ip address of the respective
incoming connection. that way one can simulate an entire proxy farm
with a single instance of tinyproxy on a multi-homed machine."
Cool.
Diffstat (limited to 'src/conns.c')
-rw-r--r-- | src/conns.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/conns.c b/src/conns.c index c7091a3..c94b245 100644 --- a/src/conns.c +++ b/src/conns.c @@ -1,4 +1,4 @@ -/* $Id: conns.c,v 1.21 2004-02-13 21:27:42 rjkaes Exp $ +/* $Id: conns.c,v 1.22 2004-04-27 18:53:14 rjkaes Exp $ * * Create and free the connection structure. One day there could be * other connection related tasks put here, but for now the header @@ -27,7 +27,8 @@ #include "stats.h" struct conn_s * -initialize_conn(int client_fd, const char* ipaddr, const char* string_addr) +initialize_conn(int client_fd, const char* ipaddr, const char* string_addr, + const char* sock_ipaddr) { struct conn_s *connptr; struct buffer_s *cbuffer, *sbuffer; @@ -71,6 +72,7 @@ initialize_conn(int client_fd, const char* ipaddr, const char* string_addr) /* There is _no_ content length initially */ connptr->content_length.server = connptr->content_length.client = -1; + connptr->server_ip_addr = sock_ipaddr ? safestrdup(sock_ipaddr) : 0; connptr->client_ip_addr = safestrdup(ipaddr); connptr->client_string_addr = safestrdup(string_addr); @@ -122,6 +124,8 @@ destroy_conn(struct conn_s *connptr) if (connptr->error_string) safefree(connptr->error_string); + if (connptr->server_ip_addr) + safefree(connptr->server_ip_addr); if (connptr->client_ip_addr) safefree(connptr->client_ip_addr); if (connptr->client_string_addr) |