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

HTTP::Client TLS Error on 0.27.1 #7364

Closed
MineBartekSA opened this issue Feb 2, 2019 · 8 comments
Closed

HTTP::Client TLS Error on 0.27.1 #7364

MineBartekSA opened this issue Feb 2, 2019 · 8 comments

Comments

@MineBartekSA
Copy link

Description

When trying to execute an HTTP::Client request with TLS it gives an OpenSSL::SSL::Error, but only on Crystal version 0.27.1

I need the HTTP::Client to work with TLS so I had to downgrade my Crystal to 0.27.0

Code

require "openssl"
require "http/client"

res = HTTP::Client.exec "GET", "https://google.com", tls: OpenSSL::SSL::Context::Client.new
puts res.body

Run output

$ crystal run sslTest.cr 
Unhandled exception: SSL_shutdown: I/O error (OpenSSL::SSL::Error)
  from /usr/share/crystal/src/openssl/ssl/socket.cr:150:11 in 'unbuffered_close'
  from /usr/share/crystal/src/io/buffered.cr:215:5 in 'close'
  from /usr/share/crystal/src/http/client.cr:663:19 in 'close'
  from /usr/share/crystal/src/http/client.cr:516:5 in 'handle_response'
  from /usr/share/crystal/src/http/client.cr:499:12 in 'exec_internal'
  from /usr/share/crystal/src/http/client.cr:494:5 in 'exec'
  from /usr/share/crystal/src/http/client.cr:612:5 in 'exec'
  from /usr/share/crystal/src/http/client.cr:640:7 in 'exec:tls'
  from sslTest.cr:4:1 in '__crystal_main'
  from /usr/share/crystal/src/crystal/main.cr:97:5 in 'main_user_code'
  from /usr/share/crystal/src/crystal/main.cr:86:7 in 'main'
  from /usr/share/crystal/src/crystal/main.cr:106:3 in 'main'
  from __libc_start_main
  from _start
  from ???
Caused by: SSL_shutdown: Success (Errno)

Crystal version

$ crystal -v
Crystal 0.27.1 [64137d045] (2019-01-30)

LLVM: 4.0.0
Default target: x86_64-unknown-linux-gnu

My software

$ lsb_release -a
No LSB modules are available.
Distributor ID:	elementary
Description:	elementary OS 5.0 Juno
Release:	5.0
Codename:	juno
$ uname -a
Linux CodeElement 4.20.0-042000-generic #201812232030 SMP Mon Dec 24 01:32:58 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ dpkg -l | grep openssl
ii  libevent-openssl-2.1-6:amd64               2.1.8-stable-4build1                           amd64        Asynchronous event notification library (openssl)
ii  libgnutls-openssl27:amd64                  3.5.18-1ubuntu1                                amd64        GNU TLS library - OpenSSL wrapper
ii  openssl                                    1.1.0g-2ubuntu4.3                              amd64        Secure Sockets Layer toolkit - cryptographic utility
ii  perl-openssl-defaults:amd64                3build1                                        amd64        version compatibility baseline for Perl OpenSSL packages

Screenshot

The error

@Sija
Copy link
Contributor

Sija commented Feb 2, 2019

Probably related to #7068 /cc @straight-shoota

@asterite
Copy link
Member

asterite commented Feb 2, 2019

We should start having some integration tests for things like this...

@wooster0
Copy link
Contributor

wooster0 commented Feb 2, 2019

Can confirm. Since 0.27.1 all discordcr bots fail to start with this error.

@wooster0
Copy link
Contributor

wooster0 commented Feb 2, 2019

Yes it's because of #7068. It's fixed by making this here raise again: https://github.com/crystal-lang/crystal/pull/7068/files#diff-18a214102747b4ee627e8256e5d0d067L113.

@sfcgeorge
Copy link

Same issue on macOS. Integration spec probably a good idea, maybe have the Crystal client read from a Crystal server.

@WJWH
Copy link

WJWH commented Feb 4, 2019

I still don't really understand what Caused by: SSL_shutdown: Success (Errno) means exactly and why it is raised as an error. 😐

@thelinuxlich
Copy link

Still getting SSL connect: I/O error on Crystal 0.35.0

@Sija
Copy link
Contributor

Sija commented Jun 18, 2020

@thelinuxlich works for me (Crystal 0.35.0 on macOS 10.14.6).
Could you post the full code with the error and its backtrace?

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

7 participants