libwww-perl / libwww-perl/Net-HTTP
IO::Socket::SSL 2.006 changes EAGAIN to EWOULDBLOCK which breaks Net::HTTP 6.07 [rt.cpan.org #100580]
Open
Nobody has claimed this yet.
- Dominant language
- Perl
- Stars
- 20
- Forks
- 27
- PR merge metrics
- No merged PRs in 30d
Description
Migrated from rt.cpan.org#100580 (status was 'new')
Requestors:
- peter@dadeos.co.uk
From peter@dadeos.co.uk on 2014-11-27 15:38:59:
Hi,
I am using IO-Socket-SSL-2.007 together with Net-HTTP-6.07 (and
libwww-perl-6.08) on Perl 5.20.1 for Windows and am receiving "read failed:
A non-blocking socket operation could not be completed immediately." errors.
I believe that these errors are the result of a modification made to
IO::Socket::SSL in version 2.006 that changed some errors from "EAGAIN" to
"EWOULDBLOCK", which have different values on Windows (see:
https://github.com/noxxi/p5-io-socket-ssl/commit/d95289de02ca9aede1c4f86481e
8fd1daa10cc7d).
I'm afraid that I am not particularly familiar with the internals of
Net::HTTP (and LWP) but modifying the checks for "EAGAIN" to check for both
"EAGAIN" and "EWOULDBLOCK" resolve the particular issue that I am
encountering.
Thanks
Peter
--- lib\Net\HTTP\Methods.pm.orig 2014-07-24 04:27:26.000000000 -0000
+++ lib\Net\HTTP\Methods.pm 2014-11-27 15:23:57.000000000 -0000
@@ -267,13 +267,13 @@
# need to read more data to find a line ending
READ:
{
die "read timeout" unless $self->can_read;
my $n = $self->sysread($_, 1024, length);
unless (defined $n) {
- redo READ if $!{EINTR} || $!{EAGAIN};
+ redo READ if $!{EINTR} || $!{EAGAIN} ||
$!{EWOULDBLOCK};
# if we have already accumulated some data let's at
least
# return that as a line
die "$what read failed: $!" unless length;
}
unless ($n) {
return undef unless length;
--- lib\LWP\Protocol\http.pm.orig 2014-07-25 04:13:08.000000000 -0000
+++ lib\LWP\Protocol\http.pm 2014-11-27 15:07:36.000000000 -0000
@@ -460,13 +460,13 @@
my $buf = ""; #prevent use of uninitialized value in SSLeay.xs
my $n;
READ:
{
$n = $socket->read_entity_body($buf, $size);
unless (defined $n) {
- redo READ if $!{EINTR} || $!{EAGAIN} || $!{ENOTTY};
+ redo READ if $!{EINTR} || $!{EAGAIN} || $!{EWOULDBLOCK} ||
$!{ENOTTY};
die "read failed: $!";
}
redo READ if $n == -1;
}
$complete++ if !$n;
return \$buf;
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing lib/Net/HTTP/Methods.pm and lib/LWP/Protocol/http.pm, focusing on the READ blocks that currently check EAGAIN while handling socket reads. Compare the reported IO::Socket::SSL 2.006 behavior on Windows and verify that both affected paths handle the reported non-blocking error consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- perl
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100