]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix 80-test_cmp_http.t to be more flexible regarding IP versions
authorRichard Levitte <levitte@openssl.org>
Thu, 7 Sep 2023 05:34:33 +0000 (07:34 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 8 Sep 2023 06:25:09 +0000 (08:25 +0200)
Because apps/lib/http_server.c had a hard coded "[::]" for the accept host,
80-test_cmp_http.t assumed that it would always get a CMP server on an IPv6
address, and tested for that.

With the fix in apps/lib/http_server.c, that test was of course doomed to
fail.  Since CMP should be about IP version testing, 80-test_cmp_http.t is
adapted to allow the Mock server to accept connections on either IP version,
and the test for IPv6 is removed.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21989)

test/recipes/80-test_cmp_http.t
test/recipes/80-test_cmp_http_data/test_connection.csv

index 6cfdcaedfd146259c0f188866816d34a2109aa30..bd4df0dd0dc2c9e4b96a340457e0047877b1e7e9 100644 (file)
@@ -299,16 +299,19 @@ sub start_server {
     }
     print "$server_name server PID=$pid\n";
 
-    if ($server_port == 0) {
-        # Find out the actual server port and possibly different PID
+    if ($server_host eq '*' || $server_port == 0) {
+        # Find out the actual server host and port and possibly different PID
         $pid = 0;
         while (<$server_fh>) {
             print "$server_name server output: $_";
             next if m/using section/;
             s/\R$//;                # Better chomp
-            ($server_port, $pid) = ($1, $2) if /^ACCEPT\s.*:(\d+) PID=(\d+)$/;
+            ($server_host, $server_port, $pid) = ($1, $2, $3)
+                if /^ACCEPT\s(.*?):(\d+) PID=(\d+)$/;
             last; # Do not loop further to prevent hangs on server misbehavior
         }
+        $server_host = "[::1]" if $server_host eq "[::]";
+        $server_host = "127.0.0.1" if $server_host eq "0.0.0.0";
     }
     unless ($server_port > 0) {
         stop_server($server_name, $pid);
index 3c0a598d11cecaf39dd31ea7fa6dfb30cd66ca6a..202eb223c496a7349376206c0c34df40535af22c 100644 (file)
@@ -3,7 +3,6 @@ expected,description, -section,val, -server,val, -proxy,val, -no_proxy,val, -tls
 ,,,,,,,,,,,,,,,,,,,
 1,default config, -section,,,,,,,,BLANK,,,,BLANK,,BLANK,,BLANK,
 1,server domain name, -section,, -server,localhost:_SERVER_PORT,,,,,,,,,,,,,,
-1,server IPv6 address, -section,, -server,[::1]:_SERVER_PORT,,,,,,,,,,,,,,
 ,,,,,,,,,,,,,,,,,,,
 0,wrong server, -section,, -server,xn--rksmrgs-5wao1o.example.com:_SERVER_PORT,,,,,BLANK,,,, -msg_timeout,1,BLANK,,BLANK,
 0,wrong server port, -section,, -server,_SERVER_HOST:99,,,,,BLANK,,,, -msg_timeout,1,BLANK,,BLANK,