using ssl now

This commit is contained in:
Thomas von Dein
2017-09-18 13:34:56 +02:00
parent 46a9101b5f
commit 71aeaada6b

19
Org.pm
View File

@@ -7,14 +7,14 @@
# or service marks of their respective holders. # or service marks of their respective holders.
package WWW::Dict::Leo::Org; package WWW::Dict::Leo::Org;
$WWW::Dict::Leo::Org::VERSION = "2.00"; $WWW::Dict::Leo::Org::VERSION = "2.01";
use strict; use strict;
use warnings; use warnings;
use English '-no_match_vars'; use English '-no_match_vars';
use Carp::Heavy; use Carp::Heavy;
use Carp; use Carp;
use IO::Socket; use IO::Socket::SSL;
use MIME::Base64; use MIME::Base64;
use XML::Simple; use XML::Simple;
use Encode; use Encode;
@@ -27,7 +27,7 @@ sub new {
my %settings = ( my %settings = (
"-Host" => "dict.leo.org", "-Host" => "dict.leo.org",
"-Port" => 80, "-Port" => 443,
"-UserAgent" => "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0", "-UserAgent" => "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0",
"-Proxy" => "", "-Proxy" => "",
"-ProxyUser" => "", "-ProxyUser" => "",
@@ -148,10 +148,11 @@ sub translate {
$url = "/dictQuery/m-vocab/$lang{speak}/query.xml"; $url = "/dictQuery/m-vocab/$lang{speak}/query.xml";
} }
my $conn = new IO::Socket::INET( my $conn = new IO::Socket::SSL(
Proto => "tcp", #Proto => "tcp",
PeerAddr => $ip, PeerAddr => $ip,
PeerPort => $port, PeerPort => $port,
SSL_verify_mode => SSL_VERIFY_NONE
) or die "Unable to connect to $ip:$port: $!\n"; ) or die "Unable to connect to $ip:$port: $!\n";
$conn->autoflush(1); $conn->autoflush(1);
@@ -293,9 +294,9 @@ sub form {
} }
sub debug { sub debug {
my($this, $msg) = @_; my($this, @msg) = @_;
if ($this->{"-Debug"}) { if ($this->{"-Debug"}) {
print STDERR "%DEBUG: $msg\n"; print STDERR "%DEBUG: " . join(" ", @msg) . "\n";
} }
} }
@@ -494,6 +495,6 @@ Please don't forget to add debugging output!
=head1 VERSION =head1 VERSION
2.00 2.01
=cut =cut