blob: b16a178e1c59abdf547314c822329a9e21da6e73 (
plain) (
blame)
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
|
#!/usr/bin/perl
# this is a gemini client
use strict;
use warnings;
use utf8;
use bytes;
our $VERSION = '0.0.1';
# Modules
use IO::Socket::SSL; # CPAN
use URL::XS qw(parse_url split_url_path parse_url_query); # CPAN
# Global variables
# ARGV[0]: gemini://website.com/request-path.gmi
my $url = $ARGV[0];
$url = parse_url($url);
my $cl = IO::Socket::SSL->new(
PeerHost => "$url->{host}",
PeerPort => '1965',
SSL_verify_mode => SSL_VERIFY_NONE,
# will update version when support is better or
# when gemini removes TLSv1_2 as a supported version
SSL_version => 'TLSv1_2',
) or die "error=$!, ssl_error=$SSL_ERROR";
print $cl "$url->{scheme}://$url->{host}/$url->{path}\r\n";
print <$cl>;
|