Hi there,
I need your help. I've been playing around with the code example from
IO::Socket::Async::SSL and I am to stupid to get a propper error
handling to work.
use v6;
use IO::Socket::Async::SSL;
react {
my %ssl-config =
certificate-file => 'cert.pem',
private-key-file => 'key.pem';
QUIT { say "this is quit outside whenever", $_.backtrace.full }
CATCH { say "this is catch outside whenever", $_.backtrace.full }
whenever IO::Socket::Async::SSL.listen('localhost', 4433,
|%ssl-config) -> $conn {
my $req = '';
QUIT { say "this is quit inside whenever", $_.backtrace.full }
CATCH { say "this is catch inside whenever", $_.backtrace.full }
whenever $conn {
$req ~= $_;
if $req.contains("\r\n\r\n") {
say $req.lines[0];
try await $conn.print(
"HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n" ~
"<strong>Hello from a Perl 6 HTTP server</strong>\n");
$conn.close;
}
}
}
}
what I am looking for is an example that dosen't shut down the server,
or leaves the react block, for incomming http traffic or for ssl
negotiation errors that might happen.
Thanks
Martin