X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=t%2Fhttpd-https.t;h=d42d7c509949ce7137770bb9a8ed488650bac4ef;hb=f0b735529e3083e222f3edd6644cd927ad35bb39;hp=ee5ced0f6df9dd9f7aee8f320062e9fcb22afffe;hpb=9689c65f42c0acc9021953b29ce55730c4cd841d;p=public-inbox.git
diff --git a/t/httpd-https.t b/t/httpd-https.t
index ee5ced0f..d42d7c50 100644
--- a/t/httpd-https.t
+++ b/t/httpd-https.t
@@ -1,4 +1,4 @@
-# Copyright (C) 2019 all contributors
+# Copyright (C) 2019-2021 all contributors
# License: AGPL-3.0+
use strict;
use warnings;
@@ -21,7 +21,7 @@ my $err = "$tmpdir/stderr.log";
my $out = "$tmpdir/stdout.log";
my $https = tcp_server();
my $td;
-my $https_addr = $https->sockhost . ':' . $https->sockport;
+my $https_addr = tcp_host_port($https);
for my $args (
[ "-lhttps://$https_addr/?key=$key,cert=$cert" ],
@@ -53,11 +53,12 @@ for my $args (
# normal HTTPS
my $c = tcp_connect($https);
IO::Socket::SSL->start_SSL($c, %o);
- ok($c->print("GET /empty HTTP/1.1\r\n\r\nHost: example.com\r\n\r\n"),
- 'wrote HTTP request');
+ $c->print("GET /url_scheme HTTP/1.1\r\n\r\nHost: example.com\r\n\r\n")
+ or xbail "failed to write HTTP request: $!";
my $buf = '';
- sysread($c, $buf, 2007, length($buf)) until $buf =~ /\r\n\r\n/;
+ sysread($c, $buf, 2007, length($buf)) until $buf =~ /\r\n\r\nhttps?/;
like($buf, qr!\AHTTP/1\.1 200!, 'read HTTP response');
+ like($buf, qr!\r\nhttps\z!, "psgi.url_scheme is 'https'");
# HTTPS with bad hostname
$c = tcp_connect($https);
@@ -97,8 +98,10 @@ for my $args (
skip 'accf_data not loaded? kldload accf_data', 2;
}
require PublicInbox::Daemon;
- my $var = PublicInbox::Daemon::SO_ACCEPTFILTER();
- my $x = getsockopt($https, SOL_SOCKET, $var);
+ ok(defined($PublicInbox::Daemon::SO_ACCEPTFILTER),
+ 'SO_ACCEPTFILTER defined');
+ my $x = getsockopt($https, SOL_SOCKET,
+ $PublicInbox::Daemon::SO_ACCEPTFILTER);
like($x, qr/\Adataready\0+\z/, 'got dataready accf for https');
};