Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installation / use Cro::HTTP (windows 10) #133

Open
michaeldesu opened this issue Dec 14, 2020 · 4 comments
Open

installation / use Cro::HTTP (windows 10) #133

michaeldesu opened this issue Dec 14, 2020 · 4 comments

Comments

@michaeldesu
Copy link

Trying to get HTTP::Client to work on Windows 10. I'm reporting some issues I've found so far:

Tried the following to install, but test is failing (below). So I've tried disabling test, and seems to have installed, but using it is problematic (more info underneath the following). Any assistance would be appreciated.

C:\Users\Michael>zef install Cro::HTTP
===> Searching for: Cro::HTTP
===> Updating cpan mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan1.json
===> Updating p6c mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/p6c1.json
===> Updated p6c mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/p6c1.json
===> Updated cpan mirror: https://raw.githubusercontent.com/ugexe/Perl6-ecosystems/master/cpan1.json
===> Searching for missing dependencies: IO::Socket::Async::SSL, Base64, HTTP::HPACK, Cro::Core, Cro::TLS, Crypt::Random, JSON::JWT, Log::Timeline
===> Searching for missing dependencies: Digest::HMAC, if
===> Testing: IO::Socket::Async::SSL:ver<0.7.6>:auth
===> Testing [OK] for IO::Socket::Async::SSL:ver<0.7.6>:auth
===> Testing: Base64:ver<0.0.2>:authgithub:ugexe
===> Testing [OK] for Base64:ver<0.0.2>:authgithub:ugexe
===> Testing: HTTP::HPACK:ver<0.9.2>
===> Testing [OK] for HTTP::HPACK:ver<0.9.2>
===> Testing: Cro::Core:ver<0.8.4>
===> Testing [OK] for Cro::Core:ver<0.8.4>
===> Testing: Cro::TLS:ver<0.8.4>
===> Testing [OK] for Cro::TLS:ver<0.8.4>
===> Testing: if:ver<0.1.1>:authgithub:FROGGS
===> Testing [OK] for if:ver<0.1.1>:authgithub:FROGGS
===> Testing: Crypt::Random:ver<0.4.1>:authgithub:skinkade
===> Testing [OK] for Crypt::Random:ver<0.4.1>:authgithub:skinkade
===> Testing: Digest::HMAC:ver<1.0.2>:authgithub:retupmoca
===> Testing [OK] for Digest::HMAC:ver<1.0.2>:authgithub:retupmoca
===> Testing: JSON::JWT:ver<1.0>:authgithub:retupmoca
===> Testing [OK] for JSON::JWT:ver<1.0>:authgithub:retupmoca
===> Testing: Log::Timeline:ver<0.3>
===> Testing [OK] for Log::Timeline:ver<0.3>
===> Testing: Cro::HTTP:ver<0.8.4>
[Cro::HTTP] # Failed test 'Correct responses logged'
[Cro::HTTP] # at t\http-log-file.t line 67
[Cro::HTTP] # expected a match with: /'[OK] 200 / - ' ('127.0.0.1' || '::1') \n
[Cro::HTTP] # '[OK] 200 /route - ' ('127.0.0.1' || '::1') \n
[Cro::HTTP] # '[OK] 200 /route - ' ('127.0.0.1' || '::1') \n
[Cro::HTTP] # '[OK] 200 /special/first - ' ('127.0.0.1' || '::1') \n/
[Cro::HTTP] # got: ""
[Cro::HTTP] # Failed test 'Error responses logged'
[Cro::HTTP] # at t\http-log-file.t line 73
[Cro::HTTP] # expected a match with: /'[ERROR] 500 /error - ' ('127.0.0.1' || '::1') \n/
[Cro::HTTP] # got: ""
[Cro::HTTP] # You failed 2 tests of 2
===> Testing [FAIL]: Cro::HTTP:ver<0.8.4>
Aborting due to test failure: Cro::HTTP:ver<0.8.4> (use --force-test to override)


Install without test appears ok:

C:\Users\Michael>zef install --/test Cro::HTTP
===> Searching for: Cro::HTTP
===> Searching for missing dependencies: IO::Socket::Async::SSL, Base64, HTTP::HPACK, Cro::Core, Cro::TLS, Crypt::Random, JSON::JWT, Log::Timeline
===> Searching for missing dependencies: Digest::HMAC, if
===> Installing: IO::Socket::Async::SSL:ver<0.7.6>:auth
===> Installing: Base64:ver<0.0.2>:authgithub:ugexe
===> Installing: HTTP::HPACK:ver<0.9.2>
===> Installing: Cro::Core:ver<0.8.4>
===> Installing: Cro::TLS:ver<0.8.4>
===> Installing: if:ver<0.1.1>:authgithub:FROGGS
===> Installing: Crypt::Random:ver<0.4.1>:authgithub:skinkade
===> Installing: Digest::HMAC:ver<1.0.2>:authgithub:retupmoca
===> Installing: JSON::JWT:ver<1.0>:authgithub:retupmoca
===> Installing: Log::Timeline:ver<0.3>
===> Installing: Cro::HTTP:ver<0.8.4>

C:\Users\Michael>raku

use Cro::HTTP::Client;
Nil
my $resp = await Cro::HTTP::Client.get('https://www.raku.org/');
Tried to get the result of a broken Promise
in block at C:\rakudo\share\perl6\site\sources\DDDD3607B617AC6B7DCA0D086AD3F4247AC394E9 (Cro::TLS) line 108

Original exception:
An operation first awaited:
in block at C:\rakudo\share\perl6\site\sources\584A708596C72A1A3A2D0C14E98DC9315145E2FE (IO::Socket::Async::SSL) line 364

Died with the exception:
    Server certificate verification failed: unable to get local issuer certificate
      in block  at C:\rakudo\share\perl6\site\sources\584A708596C72A1A3A2D0C14E98DC9315145E2FE (IO::Socket::Async::SSL) line 364

--

Cro::TLS & IO::Socket::Async::SSL appear to be installed ok.

C:\Users\Michael>zef install --/test Cro::TLS
All candidates are currently installed
No reason to proceed. Use --force-install to continue anyway

C:\Users\Michael>zef install --/test IO::Socket::Async::SSL
All candidates are currently installed
No reason to proceed. Use --force-install to continue anyway

--

Any suggestions are appreciated. I'm happy to do some more testing. Thanks.

@michaeldesu
Copy link
Author

Server certificate verification failed: unable to get local issuer certificate

in Ruby, I can disable certification validation or verification for non-production HTTPS calls using a SSL context parameter like OpenSSL::SSL::VERIFY_NONE.

How to do this with Cro?

@michaeldesu
Copy link
Author

OK I found a solution that avoid disabling cert validation (the top answer here). Any better answer is welcome. Thanks.

@jnthn
Copy link
Member

jnthn commented Dec 16, 2020

in Ruby, I can disable certification validation or verification for non-production HTTPS calls using a SSL context parameter like OpenSSL::SSL::VERIFY_NONE.

How to do this with Cro?

I was sure this was already documented, but apparently not; sorry about that. 73fd2832b1 documents how to set a custom CA file and how to disable certificate verification.

All of this is a workaround for this issue; the loading of a default OpenSSL certificate store doesn't do anything useful on Windows, so we end up without any CA certs to check against, and thus consider everything invalid.

@michaeldesu
Copy link
Author

I was also thinking how to use OpenSSL (I'm not so familiar) with it, but that link I suggested (notably setting env variable to SSL_CERT_FILE Value: C:<download-folder>\cacert.pem) worked well (the OS seems to deal with it, so no need to do/set anything with Cro it would seem).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants