I have a special purpose http server made from HTTP::Daemon primarily to
provide a local browser GUI interface to configure some software. It needs
to work on both UNXI/Linux/BSD and on Windows with IE, with identical code
if at all possible. It does work fine on Linux. On Windows I get the
following strange behavior with IE that I haven't yet been able fix:
Successful scenario:
-One or more IE windows is already open on the server host;
-create the server;
-open the startup window for the process in IE (i.e. open an html
startup file on the local file system) to GET the config file from the
server ;
-loop the server waiting for a connection and request;
-send the http GET request (i.e. SUBMIT the form with the desired
filename filled in);
= everything works OK: requests get processed OK and responses sent
properly.
Failure scenario:
-No IE window open on the server host:
-create the server;
-open the startup window for the process in IE (i.e. open an html
startup file on the local file system) to GET the config file from the
server ;
-loop the server waiting for a connection and request;
-send the http GET request (i.e. SUBMIT the form with the desired
filename filled in);
= NOTHING, no request is ever received by the server!
The code (same for both OS's) is:
use strict;
use HTTP::Daemon;
use HTTP::Status;
use Sys::Hostname;
my ($Conn, $Req);
.....
my $Dmn = HTTP::Daemon->new(
LocalAddr => hostname,
LocalPort => $Port,
Listen => 5,
Proto => 'tcp'
)
or print "failed to create server due to: $!\n"
and exit 1 ;
addServerRootURLtoStartupFile($Dmn->url); # does just what it says.
`startupfile.html` and print "problem with startupfile.html due to: $!\n"; #
opens the file in a new IE window on Windows
while ($Conn = $Dmn->accept) {
while ($Req = $Conn->get_request) {
if ($Req->method eq 'GET') {
print "Received GET\n";
# Process GET's
}
elseif ($Req->method eq 'POST') {
print "Received POST\n";
# Process POST's
}
else {
print "Received unrecognized request\n";
$Conn->send_error('Unrecognized request')
}
} # end while request
$Conn->close;
undef ($Conn);
} # end while accept
exit;
The server code above has worked fine in all other cases on both systems for
a couple years and reliably reports when a request is received.
This bizarre behavior has been verified on both Windows XP and Windows 2000,
with IE 6.0 in both cases.
Anyone have any clues as to what might be wrong here on Windows?
TIA,
Jim Eshelman
www.nepm.net
Network Monitoring with a difference
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm