2012-01-30 37 views
0

我下載HTTP::Daemon::SSL草莓的Perl 5.10從CPAN和運行這個例子:如何使HTTP :: Daemon :: SSL在沒有證書的情況下工作?

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; 

,得到了相同的結果。

回答

相關問題