[英]HTTP::Request in perl using LWP:UserAgent for authentification: CRFS issue
[英]Perl LWP::UserAgent request does not return using http1.1 but working fine using http1.0!? Why?
我有一個非常簡單的腳本(在SLES11系統上),可以將http1.1請求發送到服務器。 長期運行良好。 幾天以來,它停止工作了。 我不知道為什么。 經過一番調查,我發現強制腳本使用http1.0可以再次運行。 我不知道為什么。 我想知道為什么它不能在默認的http1.1模式下工作。
據我所知,我已經啟用了調試功能(請參見下面的代碼)。 但是我什么也沒看到-我的腳本掛了。 沒有網絡活動。 我看不到套接字將是openend(netstat -a),也看不到服務器上來自客戶端的任何傳入流量。 (“ telnet myserver myport”工作正常。)
有人可以幫我解決這個問題嗎? 如何啟用更多調試以查看真正的問題在哪里?
#!/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()不返回! 我需要殺死/ ^ C腳本!
編輯:好的,似乎沒有人知道如何繼續。 因此,我開始使用perl調試器對其進行調試。
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 );
因此,我可以看到它不是從request()返回。
無論如何,由於LWP::UserAgent
調用HTTP::Request::Common
的事實,我將上面的示例代碼改回為使用HTTP::Request::Common
在調試時跳過了這一步。
確定...新結果:
LWP::Protocol::implementor(/usr/lib/perl5/site_perl/5.10.0/Net/HTTPS.pm:26):
26: eval { require IO::Socket::SSL; };
在request()內部,它掛在IO::Socket::SSL
。 意味着,此腳本足以進行進一步調試:
#!/usr/bin/perl
require IO::Socket::SSL;
這句話不會回來。
再往下,在IO::Socket::SSL
內部,它掛在:
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();
哈啊! 已經存在有關此問題的錯誤報告: Net-SSLeay掛在Suse 11 P2上,指向錯誤#81575 ,內容為:
我在SLES 11 SP2(安裝了openssl-0.9.8j)上發現了同樣的問題。 升級到openssl-0.9.8r確實解決了問題。 ...可以在以下存儲庫中找到0.9.8r的軟件包: http : //download.opensuse.org/repositories/security :/fips/
猜猜就是這樣!
已經存在有關此問題的錯誤報告: Net-SSLeay掛在Suse 11 P2上,指向錯誤#81575 ,內容為:
我在SLES 11 SP2(安裝了openssl-0.9.8j)上發現了同樣的問題。 升級到openssl-0.9.8r確實解決了問題。 ...可以在以下存儲庫中找到0.9.8r的軟件包: http : //download.opensuse.org/repositories/security :/fips/
猜猜就是這樣!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.