Thread Problem mit LWP::UserAgent und SSL request unter Strawberry Perl (14 answers)
Opened by Bernhard at 2015-04-03 14:56

GwenDragon
 2015-04-03 18:21
#180561 #180561
User since
2005-01-17
14748 Artikel
Admin1
[Homepage]
user image
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;
use IO::Socket::SSL qw(debug3);
use LWP::UserAgent; 
use Mozilla::CA;

IO::Socket::SSL::set_ctx_defaults( 
        SSL_verify_mode => SSL_VERIFY_CLIENT_ONCE,
        SSL_ca_file => Mozilla::CA::SSL_ca_file(),
);

my $ua  = LWP::UserAgent->new (); 
my $req = HTTP::Request->new(
    GET => 
        'https://api.flickr.com/services/rest/?method=flickr.auth.getFrob&api_key=df2c4935d4a2dedb9e618f400e808b4c&format=rest&auth_token=72157651265610617-7929d0e254995744&api_sig=8b0edba90343f1593dcb14ad39ce07d7'
);

my $res = $ua->request($req);

print $req->as_string;

print $res->status_line, "\n";

print $res->headers_as_string;
ergibt:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
DEBUG: .../IO/Socket/SSL.pm:2602: new ctx 31057272
DEBUG: .../IO/Socket/SSL.pm:542: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:544: socket connected
DEBUG: .../IO/Socket/SSL.pm:566: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:599: using SNI with hostname api.flickr.com
DEBUG: .../IO/Socket/SSL.pm:634: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:653: set socket to non-blocking to enforce timeout=180
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:677: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:687: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:707: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:677: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:687: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:707: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:677: ssl handshake in progress
DEBUG: .../IO/Socket/SSL.pm:687: waiting for fd to become ready: SSL wants a read first
DEBUG: .../IO/Socket/SSL.pm:707: socket ready, retrying connect
DEBUG: .../IO/Socket/SSL.pm:2458: ok=0 cert=52823648
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:1791: SSL connect attempt failed

DEBUG: .../IO/Socket/SSL.pm:1796: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: .../IO/Socket/SSL.pm:673: fatal SSL error: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: .../IO/Socket/SSL.pm:542: socket not yet connected
DEBUG: .../IO/Socket/SSL.pm:544: socket connected
DEBUG: .../IO/Socket/SSL.pm:566: ssl handshake not started
DEBUG: .../IO/Socket/SSL.pm:599: using SNI with hostname api.flickr.com
DEBUG: .../IO/Socket/SSL.pm:634: request OCSP stapling
DEBUG: .../IO/Socket/SSL.pm:2458: ok=0 cert=52823312
DEBUG: .../IO/Socket/SSL.pm:667: Net::SSLeay::connect -> -1
DEBUG: .../IO/Socket/SSL.pm:1791: SSL connect attempt failed

DEBUG: .../IO/Socket/SSL.pm:1796: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: .../IO/Socket/SSL.pm:673: fatal SSL error: SSL connect attempt failed error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
DEBUG: .../IO/Socket/SSL.pm:1780: IO::Socket::IP configuration failed
DEBUG: .../IO/Socket/SSL.pm:2635: free ctx 31057272 open=31057272
DEBUG: .../IO/Socket/SSL.pm:2640: free ctx 31057272 callback
DEBUG: .../IO/Socket/SSL.pm:2647: OK free ctx 31057272
GET https://api.flickr.com/services/rest/?method=flickr.auth.getFrob&api_key=df2c4935d4a2dedb9e618f400e808b4c&format=rest&auth_token=72157651265610617-7929d0e254995744&api_sig=8b0edba90343f1593dcb14ad39ce07d7
User-Agent: libwww-perl/6.13

500 Can't connect to api.flickr.com:443
Content-Type: text/plain
Client-Date: Fri, 03 Apr 2015 16:20:22 GMT
Client-Warning: Internal response


Da muss sich wohl jemand reinhängen der IO::Socket::SSL besser kennt :/

View full thread Problem mit LWP::UserAgent und SSL request unter Strawberry Perl