Subject: | Patch: Adding local bind address to PoCo-Client-HTTP |
Date: | Thu, 10 Apr 2008 10:36:38 -0700 |
To: | rcaputo [...] pobox.com |
From: | Kim Scheibel <kim [...] scheibel.co.uk> |
Hi Rocco,
Please consider this patch for PoCo-Client-HTTP.
Best regards,
Kim
--- POE-Component-Client-HTTP-0.82/lib/POE/Component/Client/HTTP.pm
2007-02-26 23:15:01.000000000 -0800
+++ /home/kim/local/fh-build/1230/lib/perl5/site_perl/5.8.8/POE/
Component/Client/HTTP.pm 2008-04-10 10:28:46.000000000 -0700
@@ -113,6 +113,7 @@
my $alias = delete $params{Alias};
$alias = 'weeble' unless defined $alias and length $alias;
+ my $bind_addr = delete $params{BindAddr};
my $cm = delete $params{ConnectionManager};
my $request_factory = POE::Component::Client::HTTP::RequestFactory-
Show quoted text
>new(
@@ -153,6 +154,7 @@
factory => $request_factory,
cm => $cm,
is_shut_down => 0,
+ bind_addr => $bind_addr,
},
);
@@ -170,6 +172,7 @@
# have to do this here because it wants a current_session
$heap->{cm} = POE::Component::Client::Keepalive->new(
+ $heap->{bind_addr} ? (bind_address => $heap->{bind_addr}) : (),
timeout => $heap->{factory}->timeout,
) unless ($heap->{cm});
}
@@ -970,6 +973,7 @@
FollowRedirects => 2 # defaults to 0 (off)
Proxy => "http://localhost:80", # defaults to HTTP_PROXY env.
variable
NoProxy => [ "localhost", "127.0.0.1" ], # defs to NO_PROXY
env. variable
+ BindAddr => "12.34.56.78" # defaults to 0.0.0.0
);
$kernel->post(
@@ -1111,6 +1115,16 @@
NoProxy => [ "localhost", "127.0.0.1" ],
NoProxy => "localhost,127.0.0.1",
+=item BindAddr => $local_ip
+
+Specify C<BindAddr> to bind all client sockets to a particular
+local address. The value of BindAddr will be passed through
+POE::Component::Client::Keepalive to POE::Wheel::SocketFactory
+(as C<bind_address>).
+See that module's documentation for implementation details.
+
+ BindAddr => "12.34.56.78"
+
=item Protocol => $http_protocol_string
C<Protocol> advertises the protocol that the client wishes to see.