stas 2004/06/03 01:22:21
Modified: t/filter/TestFilter both_str_con_add.pm t/protocol/TestProtocol echo_block.pm echo_timeout.pm Log: - apparently setting to a blocking IO is not going to be a workaround but a requirement, so make it such (and documented) - other polish Revision Changes Path 1.16 +6 -7 modperl-2.0/t/filter/TestFilter/both_str_con_add.pm Index: both_str_con_add.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/filter/TestFilter/both_str_con_add.pm,v retrieving revision 1.15 retrieving revision 1.16 diff -u -u -r1.15 -r1.16 --- both_str_con_add.pm 1 Jun 2004 23:36:16 -0000 1.15 +++ both_str_con_add.pm 3 Jun 2004 08:22:21 -0000 1.16 @@ -3,18 +3,20 @@ # insert an input filter which lowers the case of the data # insert an output filter which adjusts s/modperl/mod_perl/ +# see also TestFilter::echo_filter + use strict; use warnings FATAL => 'all'; use Apache::Connection (); use APR::Bucket (); use APR::Brigade (); -use APR::Util (); use APR::Error (); +use APR::Socket; use base qw(Apache::Filter); -use APR::Const -compile => qw(SUCCESS EOF); +use APR::Const -compile => qw(SUCCESS EOF SO_NONBLOCK); use Apache::Const -compile => qw(OK MODE_GETLINE); sub pre_connection { @@ -53,11 +55,8 @@ sub handler { my Apache::Connection $c = shift; - # XXX: workaround to a problem on some platforms (solaris, bsd, - # etc), where Apache 2.0.49+ forgets to set the blocking mode on - # the socket - require APR::Socket; - BEGIN { use APR::Const -compile => qw(SO_NONBLOCK); } + # starting from Apache 2.0.49 several platforms require you to set + # the socket to a blocking IO mode $c->client_socket->opt_set(APR::SO_NONBLOCK => 0); my $bb = APR::Brigade->new($c->pool, $c->bucket_alloc); 1.5 +2 -3 modperl-2.0/t/protocol/TestProtocol/echo_block.pm Index: echo_block.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/echo_block.pm,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- echo_block.pm 7 May 2004 01:13:57 -0000 1.4 +++ echo_block.pm 3 Jun 2004 08:22:21 -0000 1.5 @@ -20,9 +20,8 @@ my Apache::Connection $c = shift; my APR::Socket $socket = $c->client_socket; - # make sure the socket is in the blocking mode for recv(). - # on some platforms (e.g. OSX/Solaris) httpd hands us a - # non-blocking socket + # starting from Apache 2.0.49 several platforms require you to set + # the socket to a blocking IO mode my $nonblocking = $socket->opt_get(APR::SO_NONBLOCK); if ($nonblocking) { $socket->opt_set(APR::SO_NONBLOCK => 0); 1.4 +3 -5 modperl-2.0/t/protocol/TestProtocol/echo_timeout.pm Index: echo_timeout.pm =================================================================== RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/echo_timeout.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- echo_timeout.pm 7 May 2004 03:46:27 -0000 1.3 +++ echo_timeout.pm 3 Jun 2004 08:22:21 -0000 1.4 @@ -12,7 +12,7 @@ use APR::Socket (); use Apache::Const -compile => 'OK'; -use APR::Const -compile => qw(TIMEUP); +use APR::Const -compile => qw(TIMEUP SO_NONBLOCK); use constant BUFF_LEN => 1024; @@ -20,10 +20,8 @@ my Apache::Connection $c = shift; my APR::Socket $socket = $c->client_socket; - # XXX: workaround to a problem on some platforms (solaris, bsd, - # etc), where Apache 2.0.49+ forgets to set the blocking mode on - # the socket - BEGIN { use APR::Const -compile => qw(SO_NONBLOCK) } + # starting from Apache 2.0.49 several platforms require you to set + # the socket to a blocking IO mode $c->client_socket->opt_set(APR::SO_NONBLOCK => 0); # set timeout (20 sec) so later we can do error checking on