Hi J.R.,
I think the problem is the possibly long delay between start and end of
DATA. If this delay is too long, Net::SSLeay is trying to make a new
SSL-handshake or key exchange. This modul needs a blocking connection to
do this. So i think the following (or similar) could work:
sub SMTPTraffic {
....
my $hasread;
my $blocking;
my $syserror;
if ("$fh" =~/SSL/i) { # if this is SSL
eval {
$blocking = $fh->blocking; # get the current blocking state
$fh->blocking(1); # set blocking on
local $SIG{ALRM} = sub { die "__alarm__\n" };
alarm(1); # define a 1 (or more) seconds alarm
$hasread = $fh->sysread($buf,4096); # try to read the data
$syserror = $!;
alarm(0); # reset the alarm
$fh->blocking($blocking); # set blocking to the state before
};
alarm(0); # reset the alarm in any case
if ( $@ =~ /^__alarm__$/ ) { # if we got the alarm - the
connection is broken -> done
done($fh);
return;
} elsif ($@) { # there could be an other error
eval{$fh->blocking($blocking);}; # set the blocking to state
before
}
} else { # no SSL - normal behavior
$hasread = $fh->sysread($buf,4096);
$syserror = $!;
}
if ( $hasread > 0 ) {
....
....
} elsif ($syserror =~ /Resource temporarily unavailable/i) { # this
is a normal error - we should try to repeat the read
d(55);
return;
} else {
d(5);
done($fh);
}
}
Currently we do not know, if the sysread or syswrite has no success in
SSL-connections. So anything similar in MainLoop and MainLoop2 for the
writing stuff should be done.
ASSP V1 uses IO::Select and if we get back from there a filehandle, we can
suppose that there a some data readable or writeable. In this normal case,
the switched on blocking should never fail (or block) - but if Net::SSLeay
needs to do some stuff under the cover, the connection has the right state
(blocking is 1).
Thomas
"J.R. Oldroyd" <[email protected]>
21.04.2009 10:34
Bitte antworten an
ASSP development mailing list <[email protected]>
An
ASSP development mailing list <[email protected]>
Kopie
Thema
Re: [Assp-test] SSL/TLS
On Mon, 20 Apr 2009 22:54:28 -0600, Alan McNeil <[email protected]> wrote:
>
> Confirmed - problem exists with IO:Socket:SSL 1.24, openssl
> 0.9.8g-4ubuntu3.5 on ubuntu hardy. Timeout if more than one packet in
> email.
> Alan
>
So we have problem reports on Windows, OS/X and Ubuntu.
I am using FreeBSD and do not appear to have this problem. May I
suggest you all upgrade?!
More seriously, while I have been using the SSL code for ALL email
here for the last 2 to 3 months now, without apparent problems,
perhaps I am just not encountering the same inputs. Could someone
put together a "repeat-by" description (ideally a script, or a
set of step-by-step instructions) that demonstrate the problem.
Please include specific message contents if possible.
Thanks,
-jr
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Assp-test mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-test
DISCLAIMER:
*******************************************************
This email and any files transmitted with it may be confidential, legally
privileged and protected in law and are intended solely for the use of the
individual to whom it is addressed.
This email was multiple times scanned for viruses. There should be no
known virus in this email!
*******************************************************
------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Assp-test mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/assp-test