aboutsummaryrefslogtreecommitdiff
path: root/tests/httpserver.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-16 17:52:24 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-18 22:45:28 +0200
commit80d651541537433e1363f7b4ba7497b08d0fb53f (patch)
treed8cfbaeccb174df77ea16bd9020b79bd180268b1 /tests/httpserver.pl
parente917492048f4b85a0fd58a033d10072fc7666c3b (diff)
tests: run the sws server on "any port"
Makes the test servers for HTTP and Gopher pop up on a currently unused port and runtests adapts to that! Closes #5247
Diffstat (limited to 'tests/httpserver.pl')
-rwxr-xr-xtests/httpserver.pl18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/httpserver.pl b/tests/httpserver.pl
index 05ec80ac7..58ab5d460 100755
--- a/tests/httpserver.pl
+++ b/tests/httpserver.pl
@@ -44,8 +44,9 @@ my $unix_socket; # location to place a listening Unix socket
my $ipvnum = 4; # default IP version of http server
my $idnum = 1; # default http server instance number
my $proto = 'http'; # protocol the http server speaks
-my $pidfile; # http server pid file
-my $logfile; # http server log file
+my $pidfile; # pid file
+my $portfile; # port number file
+my $logfile; # log file
my $connect; # IP to connect to on CONNECT
my $srcdir;
my $gopher = 0;
@@ -61,6 +62,12 @@ while(@ARGV) {
shift @ARGV;
}
}
+ elsif($ARGV[0] eq '--portfile') {
+ if($ARGV[1]) {
+ $portfile = $ARGV[1];
+ shift @ARGV;
+ }
+ }
elsif($ARGV[0] eq '--logfile') {
if($ARGV[1]) {
$logfile = $ARGV[1];
@@ -122,11 +129,16 @@ if(!$srcdir) {
if(!$pidfile) {
$pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
}
+if(!$portfile) {
+ $portfile = "$path/". server_portfilename($proto, $ipvnum, $idnum);
+}
if(!$logfile) {
$logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
}
-$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
+$flags .= "--pidfile \"$pidfile\" ".
+ "--logfile \"$logfile\" ".
+ "--portfile \"$portfile\" ";
$flags .= "--gopher " if($gopher);
$flags .= "--connect $connect " if($connect);
if($ipvnum eq 'unix') {