I just installed perl6 on windows server and windows 7.
I want to port a script which is already running on openbsd to a windows machine.
I tested this code:
my $resp = await Cro::HTTP::Client.get('https://www.perl6.org/');
And I'll get is this on both Windows machines:
C:\Users\Matthias\CommaProjects\testing>perl6 cro.pl6
Tried to get the result of a broken Promise
in block at C:\rakudo\share\perl6\site\sources\0609EA0BB03C70C2C15DB4B144D704
1C1059D14C (Cro::TLS) line 108
Original exception:
An operation first awaited:
in block at C:\rakudo\share\perl6\site\sources\A4ECA701FE96A8456AEB83692D
6B3C55AAFC964C (IO::Socket::Async::SSL) line 322
Died with the exception:
Server certificate verification failed: unable to get local issuer certificate
in block at C:\rakudo\share\perl6\site\sources\A4ECA701FE96A8456AEB83
692D6B3C55AAFC964C (IO::Socket::Async::SSL) line 322
Does somebody can give an hint how to get this running?
Edit: I have also tested WWW with TLS which is running well:
use WWW;
say get 'https://httpbin.org/get?foo=42&bar=x', :SomeHeader<Value>;
It looks like, support for windows is not fully implemented in cro yet. But it seems to be planned for future releases according to the roadmap. At least one of the cro dependencies has also an issue when used with windows IO::Path::ChildSecure.
As a workaround at the moment you can try to use the cacert.pem from the curl project placed in the current working directory together with your code:
use Cro::HTTP::Client;
#cacert.pem from https://curl.haxx.se/docs/caextract.html
constant %ca := { ca-file => 'cacert.pem' };
my $resp = await Cro::HTTP::Client.get('https://www.perl6.org/', :%ca);
say await $resp.body;
It has been confirmed that there are some Issues in the corresponding library. So I think this Feed here can be treated as solved. Further discussion will be happen on the github space of the lib:
https://github.com/jnthn/p6-io-socket-async-ssl/
Many thx to Jonathan there!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With