On Mon, 2002-04-22 at 21:25, Rocco Caputo wrote:
> There's a good reason for this, I think. At least, it's a half-good
> reason. Net::SSLeay requires sockets to be in blocking mode. I'm not
> sure why, but it probably has something to do with the underlying
> protocol.
Yes, I noticed that. In Net::HTTPS distributed with libwww-5.64. There
are such comments:
package Net::HTTPS;
# $Id: HTTPS.pm,v 1.2 2001/11/17 02:05:31 gisle Exp $
....
$VERSION = "0.01";
....
# The underlying SSLeay classes fails to work if the socket is
# placed in non-blocking mode. This override of the blocking
# method makes sure it stays the way it was created.
sub blocking { } # noop
Here is another posting in which Gisle pointed out that nonblocking mode
is disabled for SSL.
http:[EMAIL PROTECTED]/msg03265.html
Interestingly enough, open_ssl itself seems to allow non-blocking mode.
There is an example using select and nonblocking sockets in pages
279-282 of Eric Rescorla's SSL and TLS book (ISBN 0-201-61598-3).
> Perhaps PoCo::UserAgent can create the socket in blocking mode? I'm
> not sure what sort of effect that will have on multitasking within
> POE.
Yeah, it seems to work better w/ SSL when I change the
$object->nonblock(1) to nonblock(0).
sub spawn
{
my $class = @_ ? shift : 'POE::Component::Client::UserAgent';
$class = ref $class || $class;
my $object = $class -> SUPER::new;
bless $object, $class;
$object -> nonblock (0);
....
The question as you pointed out is whether this will have some adverse
effects. For example, is it possible to block during reading and
writing after select indicates that it's ready to be read or written?
If it does block, would setting timeout (to something much shorter than
180 seconds) for PoCoCl::UserAgent help?
Pete