Philippe M. Chiasson wrote:
Just stumbled on a little bug with protocol/pseudo_http on OSX.

The readline function that calls APR::Socket::recv() seems to assume
non-blocking IO, and it caused the problem, with EAGAIN being
return right away.

The following little patch fixes the problem by making sure the
socket is in blocking.

With the patch, the test passes OK 100% of the time.

Yeah, the same old problem. +1

We really ought to figure out why Apache doesn't do the right thing and handle that on the mod_perl level if Apache doesn't. It sucks to remember to fix that thing all the time in the tests.

Index: t/protocol/TestProtocol/pseudo_http.pmestProtocol/pseudo_http.pm | patch -
===================================================================
RCS file: /home/cvs/modperl-2.0/t/protocol/TestProtocol/pseudo_http.pm,v
retrieving revision 1.3
diff -u -I$Id -r1.3 pseudo_http.pm
--- t/protocol/TestProtocol/pseudo_http.pm 6 Jul 2004 18:51:55 -0000 1.3
+++ t/protocol/TestProtocol/pseudo_http.pm 26 Jul 2004 04:57:25 -0000
@@ -18,6 +18,7 @@
use APR::Socket ();


use Apache::Const -compile => qw(OK DONE DECLINED);
+use APR::Const -compile => qw(SO_NONBLOCK);

my @cmds = qw(date quit);
my %commands = map { $_, \&{$_} } @cmds;
@@ -25,6 +26,10 @@
sub handler {
    my $c = shift;
    my $socket = $c->client_socket;
+   +    if ($socket->opt_get(APR::SO_NONBLOCK)) {
+        $socket->opt_set(APR::SO_NONBLOCK => 0);
+    }

    if ((my $rc = greet($c)) != Apache::OK) {
        $socket->send("Say HELO first\n");


--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to