💾 Archived View for thrig.me › tech › ssl › hash.pl captured on 2024-03-21 at 16:01:53.

View Raw

More Information

⬅️ Previous capture (2023-04-19)

-=-=-=-=-=-=-

#!/usr/bin/env perl
#
# hash.pl - test that a hashed directory works

use strict;
use warnings;
# on OpenBSD:
#  doas pkg_add p5-IO-Socket-SSL
use IO::Socket::SSL;

my $host = 'thrig.me';
my $sock = IO::Socket::SSL->new(
    PeerHost    => $host,
    PeerPort    => 1965,
    SSL_ca_file => \undef,    # disable the usual file
    SSL_ca_path => './ca',    # use the custom directory
) or die "nope: $!,$SSL_ERROR\n";

# print just the response code (if any). assumes that the server is well
# behaved and actually returns two octets
syswrite $sock, "gemini://$host/\r\n";
my $buf;
sysread $sock, $buf, 2;
print $buf, "\n";