diff options
Diffstat (limited to 'tests/httpserver.pl')
-rwxr-xr-x | tests/httpserver.pl | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/tests/httpserver.pl b/tests/httpserver.pl index 37161f06..b60dadc3 100755 --- a/tests/httpserver.pl +++ b/tests/httpserver.pl @@ -6,7 +6,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -22,7 +22,8 @@ #*************************************************************************** BEGIN { - @INC=(@INC, $ENV{'srcdir'}, '.'); + push(@INC, $ENV{'srcdir'}) if(defined $ENV{'srcdir'}); + push(@INC, "."); } use strict; @@ -35,13 +36,14 @@ use serverhelp qw( my $verbose = 0; # set to 1 for debugging my $port = 8990; # just a default +my $unix_socket; # location to place a listening Unix socket my $ipvnum = 4; # default IP version of http server my $idnum = 1; # dafault 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 $connect; # IP to connect to on CONNECT my $srcdir; -my $fork; my $gopher = 0; my $flags = ""; @@ -73,6 +75,13 @@ while(@ARGV) { elsif($ARGV[0] eq '--ipv6') { $ipvnum = 6; } + elsif($ARGV[0] eq '--unix-socket') { + $ipvnum = 'unix'; + if($ARGV[1]) { + $unix_socket = $ARGV[1]; + shift @ARGV; + } + } elsif($ARGV[0] eq '--gopher') { $gopher = 1; } @@ -82,6 +91,12 @@ while(@ARGV) { shift @ARGV; } } + elsif($ARGV[0] eq '--connect') { + if($ARGV[1]) { + $connect = $ARGV[1]; + shift @ARGV; + } + } elsif($ARGV[0] eq '--id') { if($ARGV[1] =~ /^(\d+)$/) { $idnum = $1 if($1 > 0); @@ -91,9 +106,6 @@ while(@ARGV) { elsif($ARGV[0] eq '--verbose') { $verbose = 1; } - elsif($ARGV[0] eq '--fork') { - $fork = $ARGV[0]; - } else { print STDERR "\nWarning: httpserver.pl unknown parameter: $ARGV[0]\n"; } @@ -110,9 +122,18 @@ if(!$logfile) { $logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum); } -$flags .= "--gopher " if($gopher); -$flags .= "--fork " if(defined($fork)); $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; -$flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\""; +$flags .= "--gopher " if($gopher); +$flags .= "--connect $connect " if($connect); +if($ipvnum eq 'unix') { + $flags .= "--unix-socket '$unix_socket' "; +} else { + $flags .= "--ipv$ipvnum --port $port "; +} +$flags .= "--srcdir \"$srcdir\""; + +if($verbose) { + print STDERR "RUN: server/sws $flags\n"; +} exec("server/sws $flags"); |