--- loncom/lonhttpd	2003/05/02 21:03:19	1.7
+++ loncom/lonhttpd	2005/02/14 00:18:03	1.10
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-# $Id: lonhttpd,v 1.7 2003/05/02 21:03:19 www Exp $
+# $Id: lonhttpd,v 1.10 2005/02/14 00:18:03 albertel Exp $
 
 $VERSION = "1.3.2 (Demonic/Linux/LON-CAPA Derivative $Revison$)";
 
@@ -61,7 +61,7 @@ $pidfile="/home/httpd/perl/logs/lonhttpd
 
 if (-e $pidfile) {
    open(LFH,"$pidfile");
-   my $pide=<$LFH>;
+   my $pide=<LFH>;
    chomp($pide);
    close(LFH);
    if (kill 0 => $pide) { die "already running"; }
@@ -260,7 +260,9 @@ EOF
 	}
 
 
-sub bye { unlink($pidfile); exit; }
+sub bye { exit; }
+
+sub goodbye { unlink($pidfile); exit; }
 
 sub dead {
 	&htsponse(500, "Server Error");
@@ -276,7 +278,8 @@ EOF
 }
 
 $SIG{'__DIE__'} = \&dead;
-$SIG{'ALRM'} = $SIG{'TERM'} = $SIG{'INT'} = \&bye;
+$SIG{'ALRM'} = \&bye;
+$SIG{'TERM'} = $SIG{'INT'} = \&goodbye;
 
 sub master {
 	$0 = "lonhttpd: (dhttpi) handling request";
@@ -296,7 +299,7 @@ $date = "$dt/$mon/$yr:$tm +0000";
 select(STDOUT); $|=1; $address = 0; 
 alarm 1;
 while (<STDIN>) {
-	if(/^([A-Z]+)\s+([^\s]+)\s+([^\s\r\l\n]*)/) {
+	if(/^([A-Z]+)\s+(\S+)\s+(\S*)/) {
 		$method = $1;
 		$address = $2; 
 		$httpver = $3;