summaryrefslogtreecommitdiffstats
path: root/debian/vendor-h2o/t/90live-sni.t
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:12:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 21:12:02 +0000
commit77e50caaf2ef81cd91075cf836fed0e75718ffb4 (patch)
tree53b7b411290b63192fc9e924a3b6b65cdf67e9d0 /debian/vendor-h2o/t/90live-sni.t
parentAdding upstream version 1.8.3. (diff)
downloaddnsdist-77e50caaf2ef81cd91075cf836fed0e75718ffb4.tar.xz
dnsdist-77e50caaf2ef81cd91075cf836fed0e75718ffb4.zip
Adding debian version 1.8.3-2.debian/1.8.3-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/vendor-h2o/t/90live-sni.t')
-rw-r--r--debian/vendor-h2o/t/90live-sni.t91
1 files changed, 91 insertions, 0 deletions
diff --git a/debian/vendor-h2o/t/90live-sni.t b/debian/vendor-h2o/t/90live-sni.t
new file mode 100644
index 0000000..eb5bb5d
--- /dev/null
+++ b/debian/vendor-h2o/t/90live-sni.t
@@ -0,0 +1,91 @@
+use strict;
+use warnings;
+use Digest::MD5 qw(md5_hex);
+use Test::More;
+use t::Util;
+
+our $CA_CERT = "misc/test-ca/ca.crt";
+
+# using wget since curl of OS X 10.9.5 returns invalid certificate chain error with the test
+plan skip_all => 'wget not found'
+ unless prog_exists('wget');
+
+plan skip_all => 'only wget >= 1.14 supports SNI'
+ unless `wget --version` =~ /^GNU Wget 1\.([0-9]+)/ && $1 >= 14;
+
+plan skip_all => "skipping live tests (setenv LIVE_TESTS=1 to run them)"
+ unless $ENV{LIVE_TESTS};
+
+subtest "basic" => sub {
+ my $server = spawn_h2o(sub {
+ my ($port, $tls_port) = @_;
+ return << "EOT";
+hosts:
+ "127.0.0.1.xip.io:$tls_port":
+ paths:
+ /:
+ file.dir: examples/doc_root
+ "alternate.127.0.0.1.xip.io:$tls_port":
+ listen:
+ port: $tls_port
+ ssl:
+ key-file: examples/h2o/alternate.key
+ certificate-file: examples/h2o/alternate.crt
+ paths:
+ /:
+ file.dir: examples/doc_root.alternate
+EOT
+ });
+
+ do_test(
+ "127.0.0.1.xip.io:$server->{tls_port}",
+ md5_file("examples/doc_root/index.html"),
+ );
+
+ do_test(
+ "alternate.127.0.0.1.xip.io:$server->{tls_port}",
+ md5_file("examples/doc_root.alternate/index.txt"),
+ );
+};
+
+subtest "wildcard" => sub {
+ my $server = spawn_h2o(sub {
+ my ($port, $tls_port) = @_;
+ return << "EOT";
+hosts:
+ "127.0.0.1.xip.io:$tls_port":
+ paths:
+ /:
+ file.dir: examples/doc_root
+ "*.127.0.0.1.xip.io:$tls_port":
+ listen:
+ port: $tls_port
+ ssl:
+ key-file: examples/h2o/alternate.key
+ certificate-file: examples/h2o/alternate.crt
+ paths:
+ /:
+ file.dir: examples/doc_root.alternate
+EOT
+ });
+
+ do_test(
+ "127.0.0.1.xip.io:$server->{tls_port}",
+ md5_file("examples/doc_root/index.html"),
+ );
+
+ do_test(
+ "alternate.127.0.0.1.xip.io:$server->{tls_port}",
+ md5_file("examples/doc_root.alternate/index.txt"),
+ );
+};
+
+
+done_testing();
+
+sub do_test {
+ my ($authority, $md5_expected) = @_;
+ my $content = `wget -nv --ca-certificate=$CA_CERT -O - https://$authority/`;
+ is $?, 0, "wget returns success";
+ is md5_hex($content), $md5_expected, "content is as expected";
+}