@@ -561,6 +561,111 @@ fn nginx() {
561
561
drop ( nginx_server) ;
562
562
}
563
563
564
+ #[ test]
565
+ #[ ignore]
566
+ fn nginx_1_24 ( ) {
567
+ let ( major, minor) = nginx_version ( ) ;
568
+ if major != 1 || minor < 24 {
569
+ println ! ( "skipping Nginx 1.24 tests, installed version is {major}.{minor}.x" ) ;
570
+ return ;
571
+ }
572
+
573
+ fs:: create_dir_all ( "target/nginx-tmp/1_24/html" ) . unwrap ( ) ;
574
+ fs:: write (
575
+ "target/nginx-tmp/1_24/server.conf" ,
576
+ include_str ! ( "nginx_1_24.conf" ) ,
577
+ )
578
+ . unwrap ( ) ;
579
+
580
+ let nginx_server = KillOnDrop ( Some (
581
+ Command :: new ( "tests/maybe-valgrind.sh" )
582
+ . args ( [
583
+ "nginx" ,
584
+ "-g" ,
585
+ & format ! ( "error_log stderr {NGINX_LOG_LEVEL};" ) ,
586
+ "-p" ,
587
+ "./target/nginx-tmp/1_24" ,
588
+ "-c" ,
589
+ "server.conf" ,
590
+ ] )
591
+ . spawn ( )
592
+ . unwrap ( ) ,
593
+ ) ) ;
594
+ wait_for_port ( 8447 ) ;
595
+ wait_for_port ( 8448 ) ;
596
+
597
+ // TLS 1.2 to the TLS 1.3 only port should fail w/ exit code 35
598
+ assert_eq ! (
599
+ Command :: new( "curl" )
600
+ . env( "LD_LIBRARY_PATH" , "" )
601
+ . args( [
602
+ "--cacert" ,
603
+ "test-ca/rsa/ca.cert" ,
604
+ "--tls-max" ,
605
+ "1.2" ,
606
+ "https://localhost:8447/ssl-agreed"
607
+ ] )
608
+ . stdout( Stdio :: piped( ) )
609
+ . status( )
610
+ . unwrap( )
611
+ . code( )
612
+ . unwrap( ) ,
613
+ 35
614
+ ) ;
615
+ // TLS 1.3 to the TLS 1.3 only port should succeed.
616
+ assert_eq ! (
617
+ Command :: new( "curl" )
618
+ . env( "LD_LIBRARY_PATH" , "" )
619
+ . args( [
620
+ "--cacert" ,
621
+ "test-ca/rsa/ca.cert" ,
622
+ "--tlsv1.3" ,
623
+ "https://localhost:8447/ssl-agreed"
624
+ ] )
625
+ . stdout( Stdio :: piped( ) )
626
+ . output( )
627
+ . unwrap( )
628
+ . stdout,
629
+ "protocol:TLSv1.3,cipher:TLS_AES_256_GCM_SHA384\n " . as_bytes( )
630
+ ) ;
631
+
632
+ // TLS 1.3 to the TLS 1.2 only port should fail w/ exit code 35
633
+ assert_eq ! (
634
+ Command :: new( "curl" )
635
+ . env( "LD_LIBRARY_PATH" , "" )
636
+ . args( [
637
+ "--cacert" ,
638
+ "test-ca/rsa/ca.cert" ,
639
+ "--tlsv1.3" ,
640
+ "https://localhost:8448/ssl-agreed"
641
+ ] )
642
+ . stdout( Stdio :: piped( ) )
643
+ . status( )
644
+ . unwrap( )
645
+ . code( )
646
+ . unwrap( ) ,
647
+ 35
648
+ ) ;
649
+ // TLS 1.2 to the TLS 1.2 only port should succeed.
650
+ assert_eq ! (
651
+ Command :: new( "curl" )
652
+ . env( "LD_LIBRARY_PATH" , "" )
653
+ . args( [
654
+ "--cacert" ,
655
+ "test-ca/rsa/ca.cert" ,
656
+ "--tlsv1.2" ,
657
+ "https://localhost:8448/ssl-agreed"
658
+ ] )
659
+ . stdout( Stdio :: piped( ) )
660
+ . output( )
661
+ . unwrap( )
662
+ . stdout,
663
+ "protocol:TLSv1.2,cipher:ECDHE-RSA-AES256-GCM-SHA384\n " . as_bytes( )
664
+ ) ;
665
+
666
+ drop ( nginx_server) ;
667
+ }
668
+
564
669
// Return the major and minor version components of the Nginx binary in `$PATH`.
565
670
fn nginx_version ( ) -> ( u32 , u32 ) {
566
671
let nginx_version_output = Command :: new ( "nginx" ) . args ( [ "-v" ] ) . output ( ) . unwrap ( ) ;
0 commit comments