httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ic...@apache.org
Subject svn commit: r1845767 - /httpd/test/framework/trunk/t/modules/http2.t
Date Mon, 05 Nov 2018 10:35:15 GMT
Author: icing
Date: Mon Nov  5 10:35:15 2018
New Revision: 1845767

URL: http://svn.apache.org/viewvc?rev=1845767&view=rev
Log:
Adapting version checks and test plan to make h2 test suite work on MacOS+libressl setup

Modified:
    httpd/test/framework/trunk/t/modules/http2.t

Modified: httpd/test/framework/trunk/t/modules/http2.t
URL: http://svn.apache.org/viewvc/httpd/test/framework/trunk/t/modules/http2.t?rev=1845767&r1=1845766&r2=1845767&view=diff
==============================================================================
--- httpd/test/framework/trunk/t/modules/http2.t (original)
+++ httpd/test/framework/trunk/t/modules/http2.t Mon Nov  5 10:35:15 2018
@@ -11,41 +11,50 @@ my $tls_version_suite = 4;
 my $num_suite = 24;
 my $vhost_suite = 4;
 
-my $total_tests = 2 * $num_suite + $vhost_suite + $tls_version_suite;
 
 Net::SSLeay::initialize();
 
 my $sni_available = Net::SSLeay::OPENSSL_VERSION_NUMBER() >= 0x01000000;
 my $alpn_available = $sni_available && exists &Net::SSLeay::CTX_set_alpn_protos;
 
+my $total_tests = 2 * $num_suite + $vhost_suite + ($sni_available? $tls_version_suite : 0);
+
 plan tests => $total_tests, need 'Protocol::HTTP2::Client', 
     need_module 'http2', need_min_apache_version('2.4.17');
 
 # Check support for TLSv1_2 and later
 
-my $tls_modern = 1;
-
 Apache::TestRequest::set_ca_cert();
-my $sock = Apache::TestRequest::vhost_socket('h2');
-ok ($sock && $sock->connected);
-
-my $req = "GET / HTTP/1.1\r\n".
-   "Host: " . Apache::TestRequest::hostport() . "\r\n".
-    "\r\n";
-
-ok $sock->print($req);
 
-my $line = Apache::TestRequest::getline($sock) || '';
-
-ok t_cmp($line, qr{^HTTP/1\.. 200}, "read first response-line");
-
-my $tls_version = $sock->get_sslversion();
+# If we can, detect the SSL protocol the server speaks and do not run
+# against anything pre-TLSv1.2
+# On some setups, we do not get a socket here (for not understood reasons)
+# and run the tests. Better to fail visibly then.
+# 
+my $tls_modern = 1;
+my $tls_version = 0;
 
-ok t_cmp($tls_version, qr{^(SSL|TLSv\d(_\d)?$)}, "TLS version in use");
+my $sock = Apache::TestRequest::vhost_socket('h2');
+if ( $sock ) {
+    ok ($sock->connected);
 
-if ($tls_version =~ /^(SSL|TLSv1(|_0|_1)$)/) {
-    print STDOUT "Disabling TLS tests due to TLS version $tls_version\n";
-    $tls_modern = 0;
+    my $req = "GET / HTTP/1.1\r\n".
+       "Host: " . Apache::TestRequest::hostport() . "\r\n".
+        "\r\n";
+
+    ok $sock->print($req);
+    my $line = Apache::TestRequest::getline($sock) || '';
+    ok t_cmp($line, qr{^HTTP/1\.. 200}, "read first response-line");
+    $tls_version = $sock->get_sslversion();
+    ok t_cmp($tls_version, qr{^(SSL|TLSv\d(_\d)?$)}, "TLS version in use");
+
+    if ($tls_version =~ /^(SSL|TLSv1(|_0|_1)$)/) {
+        print STDOUT "Disabling TLS tests due to TLS version $tls_version\n";
+        $tls_modern = 0;
+    }
+}
+else {
+    $tls_modern = 1;
 }
 
 Apache::TestRequest::module("http2");



Mime
View raw message