@@ -31,7 +31,7 @@ eval { IO::Socket::SSL::SSL_VERIFY_NONE(); };
31
31
plan(skip_all => ' IO::Socket::SSL too old' ) if $@ ;
32
32
33
33
my $t = Test::Nginx-> new()-> has(qw/ http http_ssl rewrite proxy/ )
34
- -> has_daemon(' openssl' )-> plan(24 );
34
+ -> has_daemon(' openssl' )-> plan(25 );
35
35
36
36
$t -> write_file_expand(' nginx.conf' , <<'EOF' );
37
37
@@ -298,6 +298,15 @@ $req x= 1000;
298
298
my $r = http($req , socket => $s ) || " " ;
299
299
is(() = $r =~ / (200 OK)/g , 1000, ' pipelined requests' );
300
300
301
+ # close_notify is sent before lingering close
302
+
303
+ TODO: {
304
+ local $TODO = ' not yet' unless $t -> has_version(' 1.19.5' );
305
+
306
+ is(get_ssl_shutdown(8085), 1, ' ssl shutdown on lingering close' );
307
+
308
+ }
309
+
301
310
# ##############################################################################
302
311
303
312
sub get {
@@ -368,4 +377,18 @@ sub get_ssl_socket {
368
377
return $s ;
369
378
}
370
379
380
+ sub get_ssl_shutdown {
381
+ my ($port ) = @_ ;
382
+
383
+ my $s = IO::Socket::INET-> new(' 127.0.0.1:' . port($port ));
384
+ my $ctx = Net::SSLeay::CTX_new() or die (" Failed to create SSL_CTX $! " );
385
+ my $ssl = Net::SSLeay::new($ctx ) or die (" Failed to create SSL $! " );
386
+ Net::SSLeay::set_fd($ssl , fileno ($s ));
387
+ Net::SSLeay::connect ($ssl ) or die (" ssl connect" );
388
+ Net::SSLeay::write ($ssl , ' GET /' . CRLF . ' extra' );
389
+ Net::SSLeay::read ($ssl );
390
+ Net::SSLeay::set_shutdown($ssl , 1);
391
+ Net::SSLeay::shutdown ($ssl );
392
+ }
393
+
371
394
# ##############################################################################
0 commit comments