changeset 1901:f9bb84e4c8e2

Tests: added HTTP/2 test with invalid h2c over ssl socket.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 31 May 2023 13:29:34 +0400
parents 236d038dc04a
children c560f5da581e
files h2_ssl.t
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/h2_ssl.t
+++ b/h2_ssl.t
@@ -82,7 +82,7 @@ open OLDERR, ">&", \*STDERR; close STDER
 open STDERR, ">&", \*OLDERR;
 
 plan(skip_all => 'no ALPN negotiation') unless defined getconn();
-$t->plan(3);
+$t->plan(4);
 
 ###############################################################################
 
@@ -112,6 +112,12 @@ my $frames = $s->read(all => [{ sid => $
 my ($frame) = grep { $_->{type} eq "HEADERS" } @$frames;
 is($frame->{headers}->{':status'}, 200, 'alpn to HTTP/2');
 
+# h2c preface on ssl-enabled socket is rejected as invalid HTTP/1.x request,
+# ensure that HTTP/2 auto-detection doesn't kick in
+
+like(http("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"), qr/Bad Request/,
+	'no h2c on ssl socket');
+
 # client cancels last stream after HEADERS has been created,
 # while some unsent data was left in the SSL buffer
 # HEADERS frame may stuck in SSL buffer and won't be sent producing alert