Crystal: OpenSSL Error: 1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

Created on 24 Jun 2017  Â·  8Comments  Â·  Source: crystal-lang/crystal

I'm seeing errors when connecting to certain sites over https such as:

Here's some code the produces the error for me:

require "http/client"

# also happens with https://www.forbes.com/
response = HTTP::Client.get "https://www.usatoday.com/"

This is the error that I get when I run it:

~ crystal ssl_error.cr
SSL_connect: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (OpenSSL::SSL::Error)
0x10e691815: *CallStack::unwind:Array(Pointer(Void)) at ??
0x10e6917b1: *CallStack#initialize:Array(Pointer(Void)) at ??
0x10e691788: *CallStack::new:CallStack at ??
0x10e68dd61: *raise<OpenSSL::SSL::Error>:NoReturn at ??
0x10e72ada3: *OpenSSL::SSL::Socket::Client#initialize<TCPSocket, OpenSSL::SSL::Context::Client, Bool, String>:Nil at ??
0x10e72acbc: *OpenSSL::SSL::Socket::Client::new:context:sync_close:hostname<TCPSocket, OpenSSL::SSL::Context::Client, Bool, String>:OpenSSL::SSL::Socket::Client at ??
0x10e71d6e1: *HTTP::Client#socket:(OpenSSL::SSL::Socket+ | TCPSocket+) at ??
0x10e71d43b: *HTTP::Client#exec_internal_single<HTTP::Request>:(HTTP::Client::Response | Nil) at ??
0x10e71aeec: *HTTP::Client#exec_internal<HTTP::Request>:HTTP::Client::Response at ??
0x10e71ade2: *HTTP::Client#exec<HTTP::Request>:HTTP::Client::Response at ??
0x10e71ab4d: *HTTP::Client#exec<String, String, Nil, Nil>:HTTP::Client::Response at ??
0x10e71a54a: *HTTP::Client::exec<String, String, Nil, Nil, Nil>:HTTP::Client::Response at ??
0x10e71a2df: *HTTP::Client::get<String>:HTTP::Client::Response at ??
0x10e67c74e: __crystal_main at ??
0x10e68ce88: main at ??

I'm running macOS 10.12.5 and have crystal installed via brew:

~ brew info crystal-lang
crystal-lang: stable 0.22.0 (bottled), HEAD
Fast and statically typed, compiled language with Ruby-like syntax
https://crystal-lang.org/
/usr/local/Cellar/crystal-lang/0.22.0 (789 files, 58.7MB) *
  Poured from bottle on 2017-06-23 at 23:54:55
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/crystal-lang.rb
==> Dependencies
Build: pkg-config ✔, libatomic_ops ✘
Required: libevent ✔, bdw-gc ✔, llvm ✔, pcre ✔, gmp ✔, libyaml ✔

Any help would be greatly appreciated! Thanks!

Most helpful comment

Yep, OSx version is broken. The homebrew version works as expected

brew install openssl
crystal your-file.cr --link-flags '-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib'

All 8 comments

Looks like an issue with openssl or the ssl config of the servers itself.

openssl s_client -connect www.usatoday.com:443

Returns

CONNECTED(00000003)
62789:error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/ssl/s23_clnt.c:593:

Yep, OSx version is broken. The homebrew version works as expected

brew install openssl
crystal your-file.cr --link-flags '-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib'

Can we close this?

Hi, I'm using Xcode version 7.0
I'm studying iOS programming, I'm trying to create a repository and I received this error:
SSL Error: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (-1)

does somebody help to me saying what should I do? thanks

Try updating your git installation! This happened on an old computer that was running < 2.0

Hi, I'm having the same problem.
I'm running git version 2.3.5.
If I try this command
openssl s_client -connect www.usatoday.com:443
it works fine.

Hey folks, this is not a general Github nor git support forum, this is the issue tracker for the Crystal programming language hosted on Github.

Let's lock.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rdp picture rdp  Â·  112Comments

farleyknight picture farleyknight  Â·  64Comments

fridgerator picture fridgerator  Â·  79Comments

xtagon picture xtagon  Â·  132Comments

MakeNowJust picture MakeNowJust  Â·  64Comments