aboutsummaryrefslogtreecommitdiff
path: root/gmi.pl
diff options
context:
space:
mode:
authorjake <jake@jakes-mail.top>2022-03-13 07:16:23 -0400
committerjake <jake@jakes-mail.top>2022-03-13 07:16:23 -0400
commit2da1dc151702d96924929502d683852235f9c227 (patch)
tree30178ec5f3194d19043fc1655091308741234c9b /gmi.pl
parent81dbfbaea69161e06f6704c644d44e82999b8d88 (diff)
Shorten url(), thanks ullard
Diffstat (limited to 'gmi.pl')
-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