台风 ssl_connect_error

Typhoeus ssl_connect_error

我在 Rails 上尝试通过 Typhoeus 连接到 WebService,响应是代码 0。 它告诉我发生了 ssl_connect_error。

Typhoeus 的文档说要阅读消息详细信息以了解错误的性质。

一段时间后我可以得到生成的 curl url 并且我得到了潜在的错误

error:141A318A:SSL routines:tls_process_ske_dhe:dh key too small

有没有办法在DH Key too small错误的情况下得到正确的请求?我尝试连接的服务器很大,所以任何需要的升级都不会很快被考虑在内。

一段时间后,我进入了 https://imlc.me/dh-key-too-small,它给出了如何降低自己的安全级别的指导。

但它也告诉你可以将 --cipher 'DEFAULT:!DH 添加到 curl 命令行

现在,要使该标志在 Typhoeus 中起作用,您必须向 Ethon 发送有关它的选项。在 Ethon Options 中,ssl_cipher_list 是一个有效选项。

所以现在您只需将 ssl_cipher_list 添加到您的 Request 选项中,就像这样

request = Typhoeus::Request.new(url,
                                method: method,
                                body: body,
                                headers: headers,
                                params: params,
                                ssl_cipher_list: 'DEFAULT:!DH')

谢谢,我也必须通过ssl_verifypeer: false,喜欢:

Typhoeus::Request.new(
  url, 
  method: :get,
  followlocation: true,
  ssl_cipher_list: 'DEFAULT:!DH', 
  ssl_verifypeer: false
)