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 15:33
#180550 #180550
User since
2005-01-17
14748 Artikel
Admin1
[Homepage]
user image
Die Flickr-API wird aber über einen Yahoo-Server ausgeliefert, deswegen passt das Yahoo-Zertifikat nicht zur Domain api.flickr.com, deswegen verbindet LWP mit dem Fehler.

Schau mal, wenn du die Überprüfung bei SSL abschaltest (Methode ssl_opts()):
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use LWP::UserAgent; 
use IO::Socket::SSL;
use strict;
use warnings;

my $ua  = LWP::UserAgent->new (); 
$ua->ssl_opts(
    verify_mode   => SSL_VERIFY_PEER,
    verify_hostname => 0,                # Überprüfung des Zertifikats abschalten
);
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 $res->headers_as_string;

eribt:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Cache-Control: private
Connection: close
Date: Fri, 03 Apr 2015 13:31:58 GMT
Via: http/1.1 fts125.flickr.bf1.yahoo.com (ApacheTrafficServer/4.0.2 [cMsSf ]), http/1.1 r12.ycpi.dea.yahoo.net (ApacheTrafficServer [cMsSf ])
Age: 0
Server: ATS
Vary: Accept-Encoding
Content-Length: 120
Content-Type: text/xml; charset=utf-8
Client-Date: Fri, 03 Apr 2015 13:31:55 GMT
Client-Peer: 188.125.93.39:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/O=VeriSign, Inc./OU=VeriSign Trust Network/OU=Terms of use at https://www.verisign.com/rpa (c)10/CN=VeriSign Class 3 Secure Server CA - G3
Client-SSL-Cert-Subject: /C=US/ST=California/L=Sunnyvale/O=Yahoo Inc./CN=www.yahoo.com
Client-SSL-Cipher: ECDHE-RSA-AES128-SHA256
Client-SSL-Socket-Class: IO::Socket::SSL
Client-SSL-Warning: Peer certificate not verified
P3P: policyref="http://info.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC GOV"
Strict-Transport-Security: max-age=259200
X-Robots-Tag: noindex
X-Served-By: www56.flickr.bf1.yahoo.com

Last edited: 2015-04-03 15:35:15 +0200 (CEST)

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