# HG changeset patch # User Sergey Kandaurov # Date 1685525374 -14400 # Node ID f9bb84e4c8e288e3dd3368d8eeef9cbe2dee96b7 # Parent 236d038dc04a13183fbbbca572adda1783c106f6 Tests: added HTTP/2 test with invalid h2c over ssl socket. diff --git a/h2_ssl.t b/h2_ssl.t --- 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