Subject: | HTTP::Daemon::SSL ignoring timeout and incorrect list return in accept() |
HTTP::Daemon::SSL's accept method only returns when a connection is attempted, whereas it
should return (false) when the timeout (if non-0) is reached (according to HTTP::Daemon
documentation).
Also, according to the HTTP::Daemon::SSL pod, it should return two values when called in list
context which it doesn't.
Attached is a patch to resolve both of those issues (stealing part of the accept implementation
from HTTP::Daemon::SSL).
Subject: | http-daemon-ssl.patch |
--- /Users/aufflick/.cpan/build/HTTP-Daemon-SSL-1.02/SSL.pm 2004-12-13 05:05:11.000000000 +1100
+++ /opt/local/lib/perl5/site_perl/5.8.8/HTTP/Daemon/SSL.pm 2007-07-21 16:44:02.000000000 +1000
@@ -105,10 +105,13 @@
{
my $self = shift;
my $pkg = shift || "HTTP::Daemon::ClientConn::SSL";
- while (1) {
- my $sock = IO::Socket::SSL::accept($self,$pkg);
- ${*$sock}{'httpd_daemon'} = $self if ($sock);
- return $sock if ($sock || $self->errstr =~ /^IO::Socket[^\n]* accept failed$/);
+ my ($sock, $peer) = IO::Socket::SSL::accept($self,$pkg);
+ if ($sock) {
+ ${*$sock}{'httpd_daemon'} = $self;
+ return wantarray ? ($sock, $peer) : $sock;
+ }
+ else {
+ return;
}
}