Perl 如何使HTTP::Daemon::SSL在没有证书的情况下工作?
我从CPAN下载了草莓Perl 5.10,并运行了以下示例:Perl 如何使HTTP::Daemon::SSL在没有证书的情况下工作?,perl,network-programming,Perl,Network Programming,我从CPAN下载了草莓Perl 5.10,并运行了以下示例: 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
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);
}
我没有证书。是否有一个选项可以自定义此代码以在不需要证书的情况下运行它?如果是,有人能帮忙吗
我也试着替换
my $d = HTTP::Daemon::SSL->new || die
与
得到了同样的结果。你不能。只需创建一些虚拟密钥和证书进行测试
我在您提到的链接上生成了一些测试证明,但仍然无效。
my $d = HTTP::Daemon::SSL->new || die
my $d = HTTP::Daemon::SSL->new(SSL_use_cert => 0) || die;