The "hang" happens in c:\strawberry\perl\vendor\lib\Net\HTTP\Methods.pm in
the procedure
sub read_response_headers
where it calls
my($status, $eol) = my_readline($self, 'Status');

Its actually not a hang because perl is looping in my_readline where it
keeps repeating the code:

READ:
            {
                die "read timeout" unless $self->can_read;
                my $n = $self->sysread($_, 1024, length);
                unless (defined $n) {
                    redo READ if $!{EINTR} || $!{EAGAIN};

Should that be possible? Maybe the procedure could have a max number of
"redo READ"'s or a timer to give up after some time?

Best regards
Jesper Persson


On 21 May 2014 21:10, Jesper Persson <jesper.j.pers...@gmail.com> wrote:

> Well I do set the $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; so I guess the
> change shouldn't affect me.
>
> perl code
> -----------------------------------
> use LWP::Simple qw($ua get);
> use IO::Socket::SSL qw(debug3);
> $ua->timeout(5);
> $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 1;
> $contents = get("https://www.butler.edu/boa/default.aspx";);
> -----------------------------------
>
> with the perl version that doesnt hang:
>
> strawberry perl 5.18.1.1
> libwww-perl-6.05
>
> DEBUG: .../IO/Socket/SSL.pm:1805: new ctx 39861360
> DEBUG: .../IO/Socket/SSL.pm:449: socket not yet connected
> DEBUG: .../IO/Socket/SSL.pm:451: socket connected
> DEBUG: .../IO/Socket/SSL.pm:469: ssl handshake not started
> DEBUG: .../IO/Socket/SSL.pm:504: using SNI with hostname www.butler.edu
> DEBUG: .../IO/Socket/SSL.pm:527: set socket to non-blocking to enforce
> timeout=5
> DEBUG: .../IO/Socket/SSL.pm:540: Net::SSLeay::connect -> -1
> DEBUG: .../IO/Socket/SSL.pm:550: ssl handshake in progress
> DEBUG: .../IO/Socket/SSL.pm:560: waiting for fd to become ready: SSL wants
> a read first
> DEBUG: .../IO/Socket/SSL.pm:570: handshake failed because socket did not
> became ready
> DEBUG: .../IO/Socket/SSL.pm:1842: free ctx 39861360 open=39861360
> DEBUG: .../IO/Socket/SSL.pm:1847: free ctx 39861360 callback
> DEBUG: .../IO/Socket/SSL.pm:1850: OK free ctx 39861360
>
> NO HANG :-)
>
> with the perl version that hangs:
>
> strawberry 5.18.2.2
> libwww-perl-6.05
> DEBUG: .../IO/Socket/SSL.pm:2137: new ctx 49554496
> DEBUG: .../IO/Socket/SSL.pm:478: socket not yet connected
> DEBUG: .../IO/Socket/SSL.pm:480: socket connected
> DEBUG: .../IO/Socket/SSL.pm:498: ssl handshake not started
> DEBUG: .../IO/Socket/SSL.pm:528: using SNI with hostname www.butler.edu
> DEBUG: .../IO/Socket/SSL.pm:566: set socket to non-blocking to enforce
> timeout=5
> DEBUG: .../IO/Socket/SSL.pm:579: Net::SSLeay::connect -> -1
> DEBUG: .../IO/Socket/SSL.pm:589: ssl handshake in progress
> DEBUG: .../IO/Socket/SSL.pm:599: waiting for fd to become ready: SSL wants
> a read first
> DEBUG: .../IO/Socket/SSL.pm:619: socket ready, retrying connect
> DEBUG: .../IO/Socket/SSL.pm:2098: ok=1 cert=53220176
> DEBUG: .../IO/Socket/SSL.pm:2098: ok=1 cert=60570800
> DEBUG: .../IO/Socket/SSL.pm:2098: ok=1 cert=60570608
> DEBUG: .../IO/Socket/SSL.pm:1339: scheme=www cert=60570608
> DEBUG: .../IO/Socket/SSL.pm:1348: identity=www.butler.edu cn=
> www.butler.edu alt=2 www.butler.edu 2 butler.edu
> DEBUG: .../IO/Socket/SSL.pm:579: Net::SSLeay::connect -> -1
> DEBUG: .../IO/Socket/SSL.pm:589: ssl handshake in progress
> DEBUG: .../IO/Socket/SSL.pm:599: waiting for fd to become ready: SSL wants
> a read first
> DEBUG: .../IO/Socket/SSL.pm:619: socket ready, retrying connect
> DEBUG: .../IO/Socket/SSL.pm:579: Net::SSLeay::connect -> 1
> DEBUG: .../IO/Socket/SSL.pm:634: ssl handshake done
>
> HANGS FOREVER :-(
>
> /Jesper
>
>
>
> On 21 May 2014 19:03, Tom Hukins <t...@eborcom.com> wrote:
>
>> On Wed, May 21, 2014 at 06:57:58PM +0200, Jesper Persson wrote:
>> > this perl code
>> > ------------------------------------------
>> > use LWP::Simple qw($ua get);
>> > $ua->timeout(5);
>> > $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
>> > $contents = get("https://www.butler.edu/boa/default.aspx";);
>> > ------------------------------------------
>> >
>> > just tried fresh perl installs.
>> >
>> > strawberry perl 5.16.3.1:  doesnt hang.
>> >
>> > strawberry perl 5.18.0.1:  doesnt hang.
>> >
>> > strawberry perl 5.18.1.1:  doesnt hang.
>> >
>> > strawberry perl 5.18.2.1:  hangs.
>> >
>> > strawberry perl 5.18.2.2:  hangs.
>>
>> I expect you're using different versions of LWP with these different
>> versions of Perl and you're encountering the change documented at
>> https://metacpan.org/pod/LWP#PERL_LWP_SSL_VERIFY_HOSTNAME
>>
>> Tom
>>
>
>

Reply via email to