From 89f6639c84051362f6c1fe1ffda2d54fc104ac46 Mon Sep 17 00:00:00 2001 From: jake Date: Wed, 12 Jan 2022 02:41:09 -0500 Subject: Initial commit (v0.0.1) --- gmi.pl | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 gmi.pl diff --git a/gmi.pl b/gmi.pl new file mode 100755 index 0000000..b16a178 --- /dev/null +++ b/gmi.pl @@ -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>; -- cgit v1.2.3