Code Monkey home page Code Monkey logo

faraday-net_http's People

Contributors

dependabot[bot] avatar imactia avatar jandintel avatar kazarin avatar nbibler avatar olleolleolle avatar ooooooo-q avatar petergoldstein avatar semaperepelitsa avatar simi avatar tricknotes avatar xkwd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

faraday-net_http's Issues

Expose ignore_eof option for Net::HTTP (or set to it to false by default?)

Hey guys,
In 3.1.something ignore_eof option was added to Net::HTTP ruby/net-http#15 to fix a bug where EOFError gets swallowed: https://bugs.ruby-lang.org/issues/14972

I modified the code from the bug report a bit to provide a reproducible env. In the client code, there are 3 clients:

  1. most recent/default faraday-net_http adapter that swallows an error
  2. most recent faraday-exconadapter which raises an error
  3. and monkey-patched faraday-net_http adapter that raises an error

Imo, this option should be set by default to false as it's probably the right thing to do. Especially that other adapter(s), at least excon, has a proper behaviour. But maybe setting this option to false by default is a breaking change that would require a major version release? If so, I'd propose to make the option configurable via env.

pseudo server code

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'webrick' # I'm not sure if it's installed by default anymore
end

server = WEBrick::HTTPServer.new :Port => 6000
trap 'INT' do
  server.shutdown
end

server.mount_proc '/' do |req, res|
  res.status = 200
  res['Content-Type'] = 'text/plain'

  str = "0123456789"
  res.body = str
  res['Content-Length'] = str.length + 1
end

server.start

client code

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'
  gem 'faraday', '~> 2.0'
  gem 'faraday-excon', '~> 2.0'
  gem 'faraday-net_http', '~> 3.0'
end


uri = URI("http://localhost:6000/")

# most recent net http, swallows an error
streamed = []
conn = Faraday.new(uri)
conn.get('/') do |req|
  req.options.on_data = Proc.new do |chunk, overall_received_bytes, env|
    puts "Received #{overall_received_bytes} characters"
    streamed << chunk
  end
end
streamed.join

# ------

# most recent excon, raises an error (Faraday::ConnectionFailed)
# uncomment this and comment out earlier net http version

# streamed = []
# conn = Faraday.new(uri) do |f|
#   f.adapter :excon
# end
# conn.get('/') do |req|
#   req.options.on_data = Proc.new do |chunk, overall_received_bytes, env|
#     puts "Received #{overall_received_bytes} characters"
#     streamed << chunk
#   end
# end
# streamed.join

# -----

# a patched version, raises an error (Faraday::ConnectionFailed)
# uncomment this and comment out earlier excon version

# module AdapterPatch

#   def build_connection(env)
#     http = super
#     http.ignore_eof = false
#     http
#   end
# end
# Faraday::Adapter::NetHttp.prepend(AdapterPatch)

# streamed = []
# conn = Faraday.new(uri)
# conn.get('/') do |req|
#   req.options.on_data = Proc.new do |chunk, overall_received_bytes, env|
#     puts "Received #{overall_received_bytes} characters"
#     streamed << chunk
#   end
# end
# streamed.join

Net::HTTP adapter trusts all system root CAs when a ca_file is specified

Problem

Faraday always trusts the OpenSSL system root CAs, even when a :ca_file or a :ca_path are specified, eg to implement CA pinning, or to reduce the number of trusted certificates.

Example

Faraday.new('https://www.google.com', ssl: { ca_file: '/not/used/by/google/ca.pem' }).get('/') # => #<Faraday::Response:0x007ffd580b19d8 ...

Expected behavior:

An error about server certificate certificate validation, because the website's certificate does not match the :ca_file

Root Cause:

Within the net_http adapter, ssl_cert_store will create a certificate store that includes the OpenSSL system root CAs if :cert_store is not specified:

https://github.com/lostisland/faraday/blob/master/lib/faraday/adapter/net_http.rb#L105

      def ssl_cert_store(ssl)
        return ssl[:cert_store] if ssl[:cert_store]
        # Use the default cert store by default, i.e. system ca certs
        cert_store = OpenSSL::X509::Store.new
        cert_store.set_default_paths
        cert_store
      end

I would think that Faraday should only set a default :cert_store if there is no :ca_file, no :ca_path, and no :cert_store specified.

Add explicit runtime dependency on faraday itself

spec.add_development_dependency 'faraday', '>= 1.0'

The gemspec declares faraday as a development dependency, but not a runtime one. Effectively this will allow this gem to be installed with any version of Faraday, even pre-1.0 versions.

Normally this won't cause problems, but if this gem appears earlier in your Gemfile than Faraday itself or another dependency that relies on Faraday, then you can get errors because the call to register_middleware in

Faraday::Adapter.register_middleware(net_http: Faraday::Adapter::NetHttp)
will fail and you can get errors like...

NoMethodError:
  undefined method `register_middleware' for Faraday::Adapter:Class

      Faraday::Adapter.register_middleware(net_http: Faraday::Adapter::NetHttp)

Wrap Errno::EALREADY

Basic Info

  • Faraday Version: 2.3.0
  • Ruby Version: 3.1.2

Issue description

Connecting to a dead kubernetes service raises a Errno::EALREADY

Steps to reproduce

Faraday.new('http://foo.bar.svc.cluster.local').get '/'
Faraday.new('http://truth-service-x.truth-service.svc.cluster.local').get '/ping'
/usr/lib/ruby/3.1.0/socket.rb:1214:in `__connect_nonblock': Failed to open TCP connection to truth-service-x.truth-service.svc.cluster.local:80 (Operation already in progress - connect(2) for 172.29.8.85:80) (Errno::EALREADY)
	from /usr/lib/ruby/3.1.0/socket.rb:1214:in `connect_nonblock'
	from /usr/lib/ruby/3.1.0/socket.rb:56:in `connect_internal'
	from /usr/lib/ruby/3.1.0/socket.rb:137:in `connect'
	from /usr/lib/ruby/3.1.0/socket.rb:642:in `block in tcp'
	from /usr/lib/ruby/3.1.0/socket.rb:227:in `each'
	from /usr/lib/ruby/3.1.0/socket.rb:227:in `foreach'
	from /usr/lib/ruby/3.1.0/socket.rb:632:in `tcp'
	from /usr/lib/ruby/3.1.0/net/http.rb:998:in `connect'
	from /usr/lib/ruby/3.1.0/net/http.rb:976:in `do_start'
	from /usr/lib/ruby/3.1.0/net/http.rb:965:in `start'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:136:in `request_via_get_method'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:127:in `request_with_wrapped_block'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:120:in `perform_request'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:65:in `block in call'
	from /usr/bundle/ruby/3.1.0/gems/faraday-2.3.0/lib/faraday/adapter.rb:45:in `connection'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:64:in `call'
	... 23 levels...
/usr/lib/ruby/3.1.0/socket.rb:1214:in `__connect_nonblock': Operation already in progress - connect(2) for 172.29.8.85:80 (Errno::EALREADY)
	from /usr/lib/ruby/3.1.0/socket.rb:1214:in `connect_nonblock'
	from /usr/lib/ruby/3.1.0/socket.rb:56:in `connect_internal'
	from /usr/lib/ruby/3.1.0/socket.rb:137:in `connect'
	from /usr/lib/ruby/3.1.0/socket.rb:642:in `block in tcp'
	from /usr/lib/ruby/3.1.0/socket.rb:227:in `each'
	from /usr/lib/ruby/3.1.0/socket.rb:227:in `foreach'
	from /usr/lib/ruby/3.1.0/socket.rb:632:in `tcp'
	from /usr/lib/ruby/3.1.0/net/http.rb:998:in `connect'
	from /usr/lib/ruby/3.1.0/net/http.rb:976:in `do_start'
	from /usr/lib/ruby/3.1.0/net/http.rb:965:in `start'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:136:in `request_via_get_method'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:127:in `request_with_wrapped_block'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:120:in `perform_request'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:65:in `block in call'
	from /usr/bundle/ruby/3.1.0/gems/faraday-2.3.0/lib/faraday/adapter.rb:45:in `connection'
	from /usr/bundle/ruby/3.1.0/gems/faraday-net_http-2.0.2/lib/faraday/adapter/net_http.rb:64:in `call'

undefined method `idle_timeout=' for #<Net::HTTP :80 open=false>

Just wanted to mention this problem with the example in the README.

Seems like this got carried over from another adapter (net_http_persistent).

To reproduce:

irb(main):042:1* conn = Faraday.new do |f|
irb(main):043:2*   f.adapter :net_http do |http|
irb(main):044:2*     # yields Net::HTTP
irb(main):045:2*     http.idle_timeout = 100
irb(main):046:3*     http.verify_callback = lambda do |preverify, cert_store|
irb(main):047:3*       # do something here...
irb(main):048:2*     end
irb(main):049:1*   end
irb(main):050:0> end
=> 
#<Faraday::Connection:0x0000558447fe7970
...
irb(main):051:0> 
irb(main):052:0> conn.get
Traceback (most recent call last):
...
	 1: from /home/dgutov/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:188:in `configure_request'
(irb):45:in `block (2 levels) in <main>': undefined method `idle_timeout=' for #<Net::HTTP :80 open=false> (NoMethodError)

already initialized constant warnings

Hey there,
I have updated one of my gems, via bundle update and I reckon one of them gem use faraday gem as their dependency.
And now, everytime I run rspec or migration on my rails app, i have got these warnings

/usr/local/lib/ruby/2.7.0/net/protocol.rb:66: warning: already initialized constant Net::ProtocRetryError
/opt/app/vendor/bundle/ruby/2.7.0/gems/net-protocol-0.1.0/lib/net/protocol.rb:66: warning: previous definition of ProtocRetryError was here
/usr/local/lib/ruby/2.7.0/net/protocol.rb:206: warning: already initialized constant Net::BufferedIO::BUFSIZE
/opt/app/vendor/bundle/ruby/2.7.0/gems/net-protocol-0.1.0/lib/net/protocol.rb:206: warning: previous definition of BUFSIZE was here
/usr/local/lib/ruby/2.7.0/net/protocol.rb:503: warning: already initialized constant Net::NetPrivate::Socket
/opt/app/vendor/bundle/ruby/2.7.0/gems/net-protocol-0.1.0/lib/net/protocol.rb:503: warning: previous definition of Socket was here

I found out a comment in here: ruby/net-imap#16 (comment)
I wonder whether that will fix this issue.
Thanks

Conflicts with faraday-encoding

The Awesome Faraday repository identifies faraday-encoding as a useful middleware for forcing response encodings to match those sent by a server.

However, it seems as though following #13, this library conflicts with faraday-encoding and errors are thrown when they're both in use. Likely this is due to the following line (Encoding in this case is unscoped, if the faraday-encoding library is loaded, there's a Faraday::Encoding class that gets priority during this call):

content_charset = Encoding.find(match.captures.first)

NoMethodError:
  undefined method `find' for Faraday::Encoding:Class
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:213:in `block in encoded_body'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:212:in `match'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:212:in `encoded_body'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:73:in `call'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-encoding-0.0.5/lib/faraday/encoding.rb:12:in `call'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/middleware.rb:17:in `call'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-detailed_logger-2.5.0/lib/faraday/detailed_logger/middleware/current.rb:55:in `call'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-follow_redirects-0.3.0/lib/faraday/follow_redirects/middleware.rb:77:in `perform_with_redirection'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-follow_redirects-0.3.0/lib/faraday/follow_redirects/middleware.rb:65:in `call'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/middleware.rb:17:in `call'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/middleware.rb:17:in `call'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/rack_builder.rb:153:in `build_response'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/connection.rb:445:in `run_request'
/ruby/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/connection.rb:281:in `post'

It seems that either this library needs to anchor the ::Encoding.find call, identify that faraday-encoding is no longer useful, or find some other mechanism to avoid this issue.

Duplicate require warnings on Ruby 2.7.5

When I run an application which includes this gem, I get the following:

/Users/xxx/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/protocol.rb:66: warning: already initialized constant Net::ProtocRetryError
/Users/xxx/.rvm/gems/ruby-2.7.5/gems/net-protocol-0.1.3/lib/net/protocol.rb:68: warning: previous definition of ProtocRetryError was here
/Users/xxx/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/protocol.rb:206: warning: already initialized constant Net::BufferedIO::BUFSIZE
/Users/xxx/.rvm/gems/ruby-2.7.5/gems/net-protocol-0.1.3/lib/net/protocol.rb:208: warning: previous definition of BUFSIZE was here
/Users/xxx/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/protocol.rb:503: warning: already initialized constant Net::NetPrivate::Socket
/Users/xxx/.rvm/gems/ruby-2.7.5/gems/net-protocol-0.1.3/lib/net/protocol.rb:504: warning: previous definition of Socket was here

After some debugging I have been able to trace it to faraday-net_http:

	 7: from /Users/xxx/.rvm/gems/ruby-2.7.5/gems/faraday-net_http-2.0.3/lib/faraday/adapter/net_http.rb:4:in `require'
	 6: from /Users/xxx/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/https.rb:22:in `<top (required)>'
	 5: from /Users/xxx/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/https.rb:22:in `require_relative'
	 4: from /Users/xxx/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/http.rb:23:in `<top (required)>'
	 3: from /Users/xxx/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/http.rb:23:in `require_relative'
	 2: from /Users/xxx/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/protocol.rb:26:in `<top (required)>'
	 1: from /Users/xxx/.rvm/rubies/ruby-2.7.5/lib/ruby/2.7.0/net/protocol.rb:66:in `<module:Net>'

From what I understand is that Ruby 3.0 moves these dependencies from the standard lib into gems, and a such we need to require them. However Ruby 2.7 still has them in the standard lib, and thus we see the duplicate require.

Error class is different according to adapters

It seems that when timeout occurs, the error class will be different according to the adapter of Faraday as below. Is there any reason that the difference happens?

  • When you use :net_http as the adapter, you will get Faraday::ConnectionFailed.
Faraday.new(request: { timeout: 0.01 }){|f|f.adapter :net_http}.get("https://google.com:81/")
Traceback (most recent call last):
        ... 4 levels...
        16: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/connection.rb:200:in `get'
        15: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/connection.rb:445:in `run_request'
        14: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/rack_builder.rb:153:in `build_response'
        13: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:64:in `call'
        12: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/adapter.rb:45:in `connection'
        11: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:65:in `block in call'
        10: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:120:in `perform_request'
         9: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:127:in `request_with_wrapped_block'
         8: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:136:in `request_via_get_method'
         7: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:932:in `start'
         6: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:943:in `do_start'
         5: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:958:in `connect'
         4: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/timeout-0.3.0/lib/timeout.rb:186:in `timeout'
         3: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/timeout-0.3.0/lib/timeout.rb:179:in `block in timeout'
         2: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:960:in `block in connect'
         1: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:960:in `open'
/Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:960:in `initialize': Failed to open TCP connection to google.com:81 (execution expired) (Net::OpenTimeout)
        ... 4 levels...
        16: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/connection.rb:200:in `get'
        15: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/connection.rb:445:in `run_request'
        14: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/rack_builder.rb:153:in `build_response'
        13: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:64:in `call'
        12: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/adapter.rb:45:in `connection'
        11: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:65:in `block in call'
        10: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:120:in `perform_request'
         9: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:127:in `request_with_wrapped_block'
         8: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-net_http-2.0.1/lib/faraday/adapter/net_http.rb:136:in `request_via_get_method'
         7: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:932:in `start'
         6: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:943:in `do_start'
         5: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:958:in `connect'
         4: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/timeout-0.3.0/lib/timeout.rb:186:in `timeout'
         3: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/timeout-0.3.0/lib/timeout.rb:179:in `block in timeout'
         2: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:960:in `block in connect'
         1: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:960:in `open'
/Users/ham/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/http.rb:960:in `initialize': Failed to open TCP connection to google.com:81 (execution expired) (Faraday::ConnectionFailed)
  • When you use :httpclient as the adapter, you will get Faraday::TimeoutError.
Faraday.new(request: { timeout: 0.01 }){|f|f.adapter :httpclient}.get("https://google.com:81/")
Traceback (most recent call last):
        ... 8 levels...
        16: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/adapter.rb:45:in `connection'
        15: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-httpclient-2.0.1/lib/faraday/adapter/httpclient.rb:45:in `block in call'
        14: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient.rb:856:in `request'
        13: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient.rb:1014:in `do_request'
        12: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient.rb:1133:in `protect_keep_alive_disconnected'
        11: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient.rb:1019:in `block in do_request'
        10: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient.rb:1242:in `do_get_block'
         9: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:177:in `query'
         8: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:511:in `query'
         7: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:748:in `connect'
         6: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/timeout-0.3.0/lib/timeout.rb:186:in `timeout'
         5: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/timeout-0.3.0/lib/timeout.rb:179:in `block in timeout'
         4: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:752:in `block in connect'
         3: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient/ssl_socket.rb:21:in `create_socket'
         2: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:611:in `create_socket'
         1: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:611:in `new'
/Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/httpclient-2.8.3/lib/httpclient/session.rb:611:in `initialize': execution expired (HTTPClient::ConnectTimeoutError)
        24: from /Users/ham/.rbenv/versions/2.7.4/bin/irb:23:in `<main>'
        23: from /Users/ham/.rbenv/versions/2.7.4/bin/irb:23:in `load'
        22: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/irb-1.5.0/exe/irb:11:in `<top (required)>'
         5: from (irb):8:in `<main>'
         4: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/connection.rb:200:in `get'
         3: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/connection.rb:445:in `run_request'
         2: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-2.2.0/lib/faraday/rack_builder.rb:153:in `build_response'
         1: from /Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-httpclient-2.0.1/lib/faraday/adapter/httpclient.rb:37:in `call'
/Users/ham/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/faraday-httpclient-2.0.1/lib/faraday/adapter/httpclient.rb:59:in `rescue in call': Faraday::TimeoutError

Error on send Certificate array chain in ssl

Basic Info

  • Faraday Version: 1.4
  • Ruby Version: 3.0.2

Issue description

I am trying to send the array of chain certificates in the SSL hash but I cannot have an error when sending the request, to be honest, I am not sure if Faraday or the current version of faraday supports this SSL request

Steps to reproduce

Create the Certificate array chain [OpenSSL::X509::Certificate, .... n]
Add in the SSL hash in the request

post = {...}
ssl = {
   verify: true,
   client_cert: [cert_1, cert_2, cert_3],
   client_key: OpenSSL::PKey::RSA.new("Key_String")
 }
 headers = {
   'Content-Type': 'application/json'
 }
url = "https://demo.com/test"

response = JSON.parse(Faraday.new(url, ssl: ssl).send(:put, url, post.to_json, headers).body)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.