aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgmi.pl46
1 files changed, 17 insertions, 29 deletions
diff --git a/gmi.pl b/gmi.pl
index f301e78..f737609 100755
--- a/gmi.pl
+++ b/gmi.pl
@@ -26,7 +26,7 @@ use warnings;
use feature qw(refaliasing);
no warnings qw(experimental::refaliasing);
-our $VERSION = 'v1.0.1';
+our $VERSION = 'v1.0.2';
# Modules
use IO::Socket::SSL; # CPAN
@@ -38,7 +38,7 @@ use Term::ANSIColor; # Core
use Path::Naive qw(normalize_path); # CPAN
use Text::ParseWords; # Core
use Term::ReadLine; # CPAN
-use Smart::Comments; # CPAN
+#use Smart::Comments; # CPAN
use URI::Encode qw(uri_encode); # CPAN
use IO::Socket::SSL::Utils; # CPAN
use File::Slurper qw(read_dir read_text); # CPAN
@@ -269,37 +269,25 @@ sub url {
$url->{port} = '1965';
}
- my $cl;
- if ($use_cert and $cert and $key) {
- $cl = IO::Socket::SSL->new(
- PeerHost => "$url->{host}",
- PeerPort => "$url->{port}",
-
- SSL_verify_mode => SSL_VERIFY_NONE,
- SSL_verifycn_name => "$url->{host}",
- SSL_version => '!SSLv2:!SSLv3:!TLSv1:!TLSv1_1',
- SSL_fast_shutdown => 1,
-
- SSL_cert_file => "$cert",
- SSL_key_file => "$key",
-
- Timeout => 2,
- );
- }
- else {
- $cl = IO::Socket::SSL->new(
- PeerHost => "$url->{host}",
- PeerPort => "$url->{port}",
+ my %socket_options = (
+ PeerHost => "$url->{host}",
+ PeerPort => "$url->{port}",
+
+ SSL_verify_mode => SSL_VERIFY_NONE,
+ SSL_verifycn_name => "$url->{host}",
+ SSL_version => '!SSLv2:!SSLv3:!TLSv1:!TLSv1_1',
+ SSL_fast_shutdown => 1,
- SSL_verify_mode => SSL_VERIFY_NONE,
- SSL_verifycn_name => "$url->{host}",
- SSL_version => '!SSLv2:!SSLv3:!TLSv1:!TLSv1_1',
- SSL_fast_shutdown => 1,
+ Timeout => 2,
+ );
- Timeout => 2,
- );
+ if ($use_cert and $cert and $key) {
+ $socket_options{SSL_cert_file} = "$cert";
+ $socket_options{SSL_key_file} = "$key";
}
+ my $cl = IO::Socket::SSL->new( %socket_options );
+
if ($cl) {
$current_url = return_url($url);
### $current_url