diff options
author | Richard Levitte <levitte@openssl.org> | 2023-09-07 07:34:33 +0200 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2023-09-08 08:25:09 +0200 |
commit | 769e47ecddd1ca4292ffa792f45998629447d743 (patch) | |
tree | 60fb1c3be018a12e7b66bbc1511ba2e5581d6775 /test | |
parent | b0da24bd2dc64e3a01df24e01aba37fe4c269230 (diff) |
Fix 80-test_cmp_http.t to be more flexible regarding IP versions
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)
Diffstat (limited to 'test')
-rw-r--r-- | test/recipes/80-test_cmp_http.t | 9 | ||||
-rw-r--r-- | test/recipes/80-test_cmp_http_data/test_connection.csv | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t index 6cfdcaedfd..bd4df0dd0d 100644 --- a/test/recipes/80-test_cmp_http.t +++ b/test/recipes/80-test_cmp_http.t @@ -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); diff --git a/test/recipes/80-test_cmp_http_data/test_connection.csv b/test/recipes/80-test_cmp_http_data/test_connection.csv index 3c0a598d11..202eb223c4 100644 --- a/test/recipes/80-test_cmp_http_data/test_connection.csv +++ b/test/recipes/80-test_cmp_http_data/test_connection.csv @@ -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, |