mirror of
https://github.com/moparisthebest/curl
synced 2025-01-11 05:58:01 -05:00
runtests: move the gnutls-serv tests to a dynamic port
Affects test 320, 321, 322 and 324. Closes #5778
This commit is contained in:
parent
424092e70f
commit
06aa77ae33
@ -1697,7 +1697,6 @@ sub runhttpsserver {
|
||||
sub runhttptlsserver {
|
||||
my ($verbose, $ipv6) = @_;
|
||||
my $proto = "httptls";
|
||||
my $port = ($ipv6 && ($ipv6 =~ /6$/)) ? $HTTPTLS6PORT : $HTTPTLSPORT;
|
||||
my $ip = ($ipv6 && ($ipv6 =~ /6$/)) ? "$HOST6IP" : "$HOSTIP";
|
||||
my $ipvnum = ($ipv6 && ($ipv6 =~ /6$/)) ? 6 : 4;
|
||||
my $idnum = 1;
|
||||
@ -1732,40 +1731,36 @@ sub runhttptlsserver {
|
||||
|
||||
$flags .= "--http ";
|
||||
$flags .= "--debug 1 " if($debugprotocol);
|
||||
$flags .= "--port $port ";
|
||||
$flags .= "--priority NORMAL:+SRP ";
|
||||
$flags .= "--srppasswd $srcdir/certs/srp-verifier-db ";
|
||||
$flags .= "--srppasswdconf $srcdir/certs/srp-verifier-conf";
|
||||
|
||||
my $cmd = "$httptlssrv $flags > $logfile 2>&1";
|
||||
my ($httptlspid, $pid2) = startnew($cmd, $pidfile, 10, 1); # fake pidfile
|
||||
my $port = 24367;
|
||||
my ($httptlspid, $pid2);
|
||||
for (1 .. 10) {
|
||||
$port += int(rand(800));
|
||||
my $allflags = "--port $port $flags";
|
||||
|
||||
if($httptlspid <= 0 || !pidexists($httptlspid)) {
|
||||
# it is NOT alive
|
||||
logmsg "RUN: failed to start the $srvrname server\n";
|
||||
stopserver($server, "$pid2");
|
||||
displaylogs($testnumcheck);
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
my $cmd = "$httptlssrv $allflags > $logfile 2>&1";
|
||||
($httptlspid, $pid2) = startnew($cmd, $pidfile, 10, 1);
|
||||
|
||||
if($httptlspid <= 0 || !pidexists($httptlspid)) {
|
||||
# it is NOT alive
|
||||
logmsg "RUN: failed to start the $srvrname server\n";
|
||||
stopserver($server, "$pid2");
|
||||
displaylogs($testnumcheck);
|
||||
$doesntrun{$pidfile} = 1;
|
||||
$httptlspid = $pid2 = 0;
|
||||
next;
|
||||
}
|
||||
$doesntrun{$pidfile} = 0;
|
||||
|
||||
if($verbose) {
|
||||
logmsg "RUN: $srvrname server PID $httptlspid port $port\n";
|
||||
}
|
||||
last;
|
||||
}
|
||||
|
||||
# Server is up. Verify that we can speak to it. PID is from fake pidfile
|
||||
my $pid3 = verifyserver($proto, $ipvnum, $idnum, $ip, $port);
|
||||
if(!$pid3) {
|
||||
logmsg "RUN: $srvrname server failed verification\n";
|
||||
# failed to talk to it properly. Kill the server and return failure
|
||||
stopserver($server, "$httptlspid $pid2");
|
||||
displaylogs($testnumcheck);
|
||||
$doesntrun{$pidfile} = 1;
|
||||
return (0,0);
|
||||
}
|
||||
$pid2 = $pid3;
|
||||
|
||||
if($verbose) {
|
||||
logmsg "RUN: $srvrname server is now running PID $httptlspid\n";
|
||||
}
|
||||
|
||||
return ($httptlspid, $pid2);
|
||||
return ($httptlspid, $pid2, $port);
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
@ -3224,13 +3219,6 @@ sub checksystem {
|
||||
|
||||
if($verbose) {
|
||||
logmsg "* Ports: ";
|
||||
if($httptlssrv) {
|
||||
logmsg sprintf("HTTPTLS/%d ", $HTTPTLSPORT);
|
||||
if($has_ipv6) {
|
||||
logmsg sprintf("HTTPTLS-IPv6/%d ", $HTTPTLS6PORT);
|
||||
}
|
||||
logmsg "\n";
|
||||
}
|
||||
|
||||
if($has_unix) {
|
||||
logmsg "* Unix socket paths:\n";
|
||||
@ -4863,7 +4851,8 @@ sub startservers {
|
||||
stopserver('httptls');
|
||||
}
|
||||
if(!$run{'httptls'}) {
|
||||
($pid, $pid2) = runhttptlsserver($verbose, "IPv4");
|
||||
($pid, $pid2, $HTTPTLSPORT) =
|
||||
runhttptlsserver($verbose, "IPv4");
|
||||
if($pid <= 0) {
|
||||
return "failed starting HTTPTLS server (gnutls-serv)";
|
||||
}
|
||||
@ -4882,7 +4871,8 @@ sub startservers {
|
||||
stopserver('httptls-ipv6');
|
||||
}
|
||||
if(!$run{'httptls-ipv6'}) {
|
||||
($pid, $pid2) = runhttptlsserver($verbose, "ipv6");
|
||||
($pid, $pid2, $HTTPTLS6PORT) =
|
||||
runhttptlsserver($verbose, "ipv6");
|
||||
if($pid <= 0) {
|
||||
return "failed starting HTTPTLS-IPv6 server (gnutls-serv)";
|
||||
}
|
||||
@ -5496,8 +5486,6 @@ if ($gdbthis) {
|
||||
}
|
||||
|
||||
$minport = $base; # original base port number
|
||||
$HTTPTLSPORT = $base++; # HTTP TLS (non-stunnel) server port
|
||||
$HTTPTLS6PORT = $base++; # HTTP TLS (non-stunnel) IPv6 server port
|
||||
$HTTP2PORT = $base++; # HTTP/2 port
|
||||
$DICTPORT = $base++; # DICT port
|
||||
$SMBPORT = $base++; # SMB port
|
||||
|
Loading…
Reference in New Issue
Block a user