Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem with Raku and SSL on Windows Machine

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>;
like image 908
Wahnburger Avatar asked Oct 31 '19 16:10

Wahnburger


2 Answers

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;
like image 169
LuVa Avatar answered Sep 17 '22 21:09

LuVa


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!

like image 44
Wahnburger Avatar answered Sep 18 '22 21:09

Wahnburger