I downloaded HTTP::Daemon::SSL for Strawberry Perl 5.10 from CPAN and ran this example:
use HTTP::Daemon::SSL;
use HTTP::Status;
# 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 || die;
print "Please contact me at: <URL:", $d->url, ">\n";
while (my $c = $d->accept) {
while (my $r = $c->get_request) {
if ($r->method eq 'GET' and $r->url->path eq "/dir") {
# remember, this is *not* recommened practice :-)
$c->send_file_response("f.html");
} else {
$c->send_error(RC_FORBIDDEN);
}
}
$c->close;
undef($c);
}
The application died on this line:
my $d = HTTP::Daemon::SSL->new || die;
I don’t have certificates. Is there an option to customize this code to run it without the need of certificates? If yes, could someone help with this?
I also tried to replace
my $d = HTTP::Daemon::SSL->new || die
with
my $d = HTTP::Daemon::SSL->new(SSL_use_cert => 0) || die;
and got the same result.
You can’t. Simply create some dummy keys and certificates for testing.
http://httpd.apache.org/docs/en/ssl/ssl_faq.html#selfcert