2 #***************************************************************************
4 # Project ___| | | | _ \| |
6 # | (__| |_| | _ <| |___
7 # \___|\___/|_| \_\_____|
9 # Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at http://curl.haxx.se/docs/copyright.html.
15 # You may opt to use, copy, modify, merge, publish, distribute and/or sell
16 # copies of the Software, and permit persons to whom the Software is
17 # furnished to do so, under the terms of the COPYING file.
19 # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20 # KIND, either express or implied.
22 #***************************************************************************
25 @INC=(@INC, $ENV{'srcdir'}, '.');
36 my $verbose = 0; # set to 1 for debugging
37 my $port = 8990; # just a default
38 my $ipvnum = 4; # default IP version of http server
39 my $idnum = 1; # dafault http server instance number
40 my $proto = 'http'; # protocol the http server speaks
41 my $pidfile; # http server pid file
42 my $logfile; # http server log file
49 my $logdir = $path .'/log';
52 if($ARGV[0] eq '--pidfile') {
58 elsif($ARGV[0] eq '--logfile') {
64 elsif($ARGV[0] eq '--srcdir') {
70 elsif($ARGV[0] eq '--ipv4') {
73 elsif($ARGV[0] eq '--ipv6') {
76 elsif($ARGV[0] eq '--gopher') {
79 elsif($ARGV[0] eq '--port') {
80 if($ARGV[1] =~ /^(\d+)$/) {
85 elsif($ARGV[0] eq '--id') {
86 if($ARGV[1] =~ /^(\d+)$/) {
87 $idnum = $1 if($1 > 0);
91 elsif($ARGV[0] eq '--verbose') {
94 elsif($ARGV[0] eq '--fork') {
98 print STDERR "\nWarning: httpserver.pl unknown parameter: $ARGV[0]\n";
104 $srcdir = $ENV{'srcdir'} || '.';
107 $pidfile = "$path/". server_pidfilename($proto, $ipvnum, $idnum);
110 $logfile = server_logfilename($logdir, $proto, $ipvnum, $idnum);
113 $flags .= "--gopher " if($gopher);
114 $flags .= "--fork " if(defined($fork));
115 $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
116 $flags .= "--ipv$ipvnum --port $port --srcdir \"$srcdir\"";
118 exec("server/sws $flags");