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.
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");
signature.asc
Description: OpenPGP digital signature
