Perl LWP::UserAgent request does not return using http1.1 but working fine using http1.0!? Why?

StackOverflow https://stackoverflow.com/questions/16035324

Вопрос

I have a very simple script (on a SLES11 system) to send a http1.1 request to a server. This worked fine for a long time. Since a couple of days it stopped working. I have no idea why. After some investigation I found out forcing the script to use http1.0 it is working again. I have no idea why. And I want to know why it is not working in its default http1.1 mode.

I already enabled debugging as much as I know it (see code below). But I do not see anything - my script just hangs. There is no network activity. I neiter see that a socket will be openend (netstat -a), nor I see any incoming traffic form my client on the server. (A "telnet myserver myport" works fine.)

Can someone please help me how to track down this problem? How can I enable more debug to see where the real problem is?

#!/usr/bin/perl -w

use strict;
use warnings;
use Data::Dumper;
use HTTP::Request::Common;
use LWP::Debug qw(+);
use LWP::UserAgent;

# Workaround: forcing http1.0 instead of using http1.1, it works again!
use LWP::Protocol::https10 ();
LWP::Protocol::implementor('https', 'LWP::Protocol::https10');
# EO workaround

my $ua        = LWP::UserAgent->new;
$ua->ssl_opts( verify_hostname => 0 );
my $response  = $ua->request(
    POST 'https://myuser:mypassword@myserver:8888/service/myservice',
    Connection   => 'close',     # Edit: added, see comments below
    Content_Type => 'text/xml',
    Content      => '... my content ...'
);

$ua->request() does not return! I need to kill/^C the script!

Edit: ok, no one seems to have an idea how to continue. So I startet debugging it using perl debugger.

LWP::UserAgent::post(/usr/lib/perl5/site_perl/5.10.0/LWP/UserAgent.pm:418):
418:        return $self->request( HTTP::Request::Common::POST( @parameters ), @suff );

So I can see it is not returning from request().

Anyway, due to the fact that LWP::UserAgent calls HTTP::Request::Common I changed my example code above back to use HTTP::Request::Common to skip that step while debugging.

Ok... New result:

LWP::Protocol::implementor(/usr/lib/perl5/site_perl/5.10.0/Net/HTTPS.pm:26):
26:         eval { require IO::Socket::SSL; };

Inside request() it hangs at IO::Socket::SSL. Means, this script it enough for further debug:

#!/usr/bin/perl
require IO::Socket::SSL;

This statement does not come back.

Further down, inside IO::Socket::SSL it hangs at:

IO::Socket::SSL::CODE(0x1274370)(/usr/lib/perl5/site_perl/5.10.0/IO/Socket/SSL.pm:92):
92:             Net::SSLeay::SSLeay_add_ssl_algorithms();

Ahhhh! There is already a bugreport concerning this issue: Net-SSLeay hangs on Suse 11 P2 pointing to Bug #81575 that says:

I enountered this same issue on SLES 11 SP2, which has openssl-0.9.8j installed. An upgrade to openssl-0.9.8r did resolve the problem. ... The packages for 0.9.8r can be found in this repository: http://download.opensuse.org/repositories/security:/fips/

Guess that's it!

Это было полезно?

Решение

There is already a bugreport concerning this issue: Net-SSLeay hangs on Suse 11 P2 pointing to Bug #81575 that says:

I enountered this same issue on SLES 11 SP2, which has openssl-0.9.8j installed. An upgrade to openssl-0.9.8r did resolve the problem. ... The packages for 0.9.8r can be found in this repository: http://download.opensuse.org/repositories/security:/fips/

Guess that's it!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top