Subject: | Timeout still not working for HTTPS connections |
Date: | Wed, 23 Nov 2011 22:14:44 +0100 |
To: | bug-Net-HTTP [...] rt.cpan.org |
From: | Ingo van Lil <inguin [...] gmx.de> |
Hi,
the socket timeout feature is still not fully functional for HTTPS/SSL
sockets. Removing the NOP redefinition of sub blocking() improved things
a little, but when communicating with a server that completes the SSL
handshake but does not respond to the HTTP request the implementation
will still block indefinitely. See my description in the Fedora bug
tracker (https://bugzilla.redhat.com/show_bug.cgi?id=750793) for
instructions how to reproduce the issue.
I have tracked down the issue to the Net::HTTP::Methods::my_readline()
method which simply retries the read in 100ms second intervals as long
as EAGAIN is returned. The reason this is not a problem with HTTP is
that LWP::Protocol::http::SocketMethods has a custom sysread() method
which implements blocking-with-timeout behavior on a non-blocking
socket. For HTTPS the sysread() implementation of the underlying socket
class is used.
Previously, when using Net::SSL as default socket class, the problem was
worked around: The socket was never set to non-blocking and Net::SSL
would schedule an alarm before every potentially blocking operation.
I'm not sure where this problem should be fixed. Should IO::Socket::SSL
implement timeout semantics on all operations? This would only make
sense if the socket was used in blocking mode. Should Net::HTTP::Methods
regard the socket timeout in all loops? Or should LWP::Protocol::https
overwrite sysread() similar to what they do for http?
Regards,
Ingo