Hi, I'm trying to build a ssl web server that will allow mutiple connections at once. I'm using HTTP::Daemon::SSL, my code is pasted below. The forking seems to be working however if I telnet to the port the daemon is running on, then send lots of request to the daemon via a web browser, after about 10 reloads the browser stops getting responses from the serer. Once I close the other connection to the daemon, the browser gets the response its suppose to. The $rand is just to show that the response is different from the last one.
The same thing seems to happen to a non ssl daemon. Could someone point me in the right direction for making an ssl daemon that supports multiple connections? Thanks in advance. #!/usr/bin/perl $| = 1; use HTTP::Daemon::SSL; use HTTP::Status; use Net::SSLeay; use URI::URL; use strict; # Make sure you have a certs/ directory with "server-cert.pem" # and "server-key.pem" in it before running this! my $d = HTTP::Daemon::SSL->new( LocalPort => $ARGV[0], Listen => 20, Timeout => 5, Reuse => 1 ) || die; print "Please contact me at: <URL:", $d->url, ">\n"; while (my ($c) = $d->accept) { my $pid = fork(); if ($pid == 0) { while (my $r = $c->get_request) { my $rand = rand(100); print "Got Request $rand " . $r->method . "\n"; my $res = HTTP::Response->new(200); $res->content("Hello there $rand"); $c->send_response($res); } $c->close; undef($c); exit(0); } } close($d);