Subject: | Make maximum buffer size user-configurable |
Net::Proxy contains a hard-coded value ($BUFFSIZE) which is used to
determine the maximum length of the write buffer. My particular needs
require a much larger value. In fact, I would prefer that there was no
enforced maximum buffer length at all. This patch adds two new functions
- get_max_buffer_size() and set_max_buffer_size() which allow $BUFFSIZE
to be manipulated.
Subject: | net-proxy.patch |
diff -ruN Net-Proxy-0.12.orig//lib/Net/Proxy.pm Net-Proxy-0.12/lib/Net/Proxy.pm
--- Net-Proxy-0.12.orig//lib/Net/Proxy.pm 2007-10-18 00:57:44.000000000 +0200
+++ Net-Proxy-0.12/lib/Net/Proxy.pm 2010-08-26 06:38:41.449446355 +0200
@@ -82,6 +82,9 @@
sub register { $PROXY{ refaddr $_[0] } = $_[0]; }
sub unregister { delete $PROXY{ refaddr $_[0] }; }
+sub get_max_buffer_size { return $BUFFSIZE; }
+sub set_max_buffer_size { $BUFFSIZE = $_[1]; }
+
#
# The Net::Proxy attributes
#
@@ -252,7 +255,7 @@
my $peer = Net::Proxy->get_peer($sock);
next READER
if !$peer
- || length( Net::Proxy->get_buffer($peer) ) >= $BUFFSIZE;
+ || ($BUFFSIZE && length( Net::Proxy->get_buffer($peer) ) >= $BUFFSIZE);
# read the data
if ( my $conn = Net::Proxy->get_connector($sock) ) {
@@ -428,6 +431,14 @@
(Note: throughout the C<Net::Proxy> source code, calls to C<debug()> are
commented with C<##>.)
+=item get_max_buffer_size( )
+
+=item set_max_buffer_size( $size )
+
+Get or set the maximum allowed length of the internal write buffers used
+by each connector. A value of 0 means that the maximum length is not
+checked. The default value is 16384 bytes (16kB).
+
=back
Some of the class methods are related to the socket objects that handle