diff options
Diffstat (limited to 'gmi.pl')
-rwxr-xr-x | gmi.pl | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,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>; |