1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 16:18:48 -05:00

add some debug messages

This commit is contained in:
Yang Tse 2010-01-17 13:33:27 +00:00
parent 071c38988d
commit b51b703a5b

View File

@ -974,27 +974,34 @@ sub runhttpsserver {
my $flags = ""; my $flags = "";
if(!$stunnel) { if(!$stunnel) {
return 0; logmsg "DEBUG: runhttpsserver: return point 1\n";
return (0,0);
} }
$server = servername_id($proto, $ipvnum, $idnum); $server = servername_id($proto, $ipvnum, $idnum);
logmsg "DEBUG: runhttpsserver: server = $server\n";
$pidfile = $serverpidfile{$server}; $pidfile = $serverpidfile{$server};
logmsg "DEBUG: runhttpsserver: pidfile = $pidfile\n";
# don't retry if the server doesn't work # don't retry if the server doesn't work
if ($doesntrun{$pidfile}) { if ($doesntrun{$pidfile}) {
logmsg "DEBUG: runhttpsserver: return point 2\n";
return (0,0); return (0,0);
} }
my $pid = processexists($pidfile); my $pid = processexists($pidfile);
if($pid > 0) { if($pid > 0) {
logmsg "DEBUG: runhttpsserver: pid = $pid\n";
stopserver($server, "$pid"); stopserver($server, "$pid");
} }
unlink($pidfile) if(-f $pidfile); unlink($pidfile) if(-f $pidfile);
$srvrname = servername_str($proto, $ipvnum, $idnum); $srvrname = servername_str($proto, $ipvnum, $idnum);
logmsg "DEBUG: runhttpsserver: srvrname = $srvrname\n";
$logfile = server_logfilename($LOGDIR, $proto, $ipvnum, $idnum); $logfile = server_logfilename($LOGDIR, $proto, $ipvnum, $idnum);
logmsg "DEBUG: runhttpsserver: logfile = $logfile\n";
$flags .= "--verbose " if($debugprotocol); $flags .= "--verbose " if($debugprotocol);
$flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" "; $flags .= "--pidfile \"$pidfile\" --logfile \"$logfile\" ";
@ -1003,9 +1010,11 @@ sub runhttpsserver {
$flags .= "--certfile \"$certfile\" " if($certfile); $flags .= "--certfile \"$certfile\" " if($certfile);
$flags .= "--stunnel \"$stunnel\" --srcdir \"$srcdir\" "; $flags .= "--stunnel \"$stunnel\" --srcdir \"$srcdir\" ";
$flags .= "--connect $HTTPPORT --accept $HTTPSPORT"; $flags .= "--connect $HTTPPORT --accept $HTTPSPORT";
logmsg "DEBUG: runhttpsserver: flags = $flags\n";
my $cmd = "$perl $srcdir/secureserver.pl $flags"; my $cmd = "$perl $srcdir/secureserver.pl $flags";
my ($httpspid, $pid2) = startnew($cmd, $pidfile, 15, 0); my ($httpspid, $pid2) = startnew($cmd, $pidfile, 15, 0);
logmsg "DEBUG: runhttpsserver: httpspid = $httpspid : pid2 = $pid2\n";
if($httpspid <= 0 || !kill(0, $httpspid)) { if($httpspid <= 0 || !kill(0, $httpspid)) {
# it is NOT alive # it is NOT alive
@ -1013,6 +1022,7 @@ sub runhttpsserver {
stopserver($server, "$pid2"); stopserver($server, "$pid2");
displaylogs($testnumcheck); displaylogs($testnumcheck);
$doesntrun{$pidfile} = 1; $doesntrun{$pidfile} = 1;
logmsg "DEBUG: runhttpsserver: return point 3\n";
return(0,0); return(0,0);
} }
@ -1024,6 +1034,7 @@ sub runhttpsserver {
stopserver($server, "$httpspid $pid2"); stopserver($server, "$httpspid $pid2");
displaylogs($testnumcheck); displaylogs($testnumcheck);
$doesntrun{$pidfile} = 1; $doesntrun{$pidfile} = 1;
logmsg "DEBUG: runhttpsserver: return point 4\n";
return (0,0); return (0,0);
} }
# Here pid3 is actually the pid returned by the unsecure-http server. # Here pid3 is actually the pid returned by the unsecure-http server.
@ -1034,6 +1045,7 @@ sub runhttpsserver {
sleep(1); sleep(1);
logmsg "DEBUG: runhttpsserver: return point 5\n";
return ($httpspid, $pid2); return ($httpspid, $pid2);
} }
@ -1148,7 +1160,7 @@ sub runftpsserver {
my $flags = ""; my $flags = "";
if(!$stunnel) { if(!$stunnel) {
return 0; return (0,0);
} }
$server = servername_id($proto, $ipvnum, $idnum); $server = servername_id($proto, $ipvnum, $idnum);