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

Faraday::ConnectionFailed if proxy: "" is passed on Ruby 3.2.1 #1492

Closed
exoego opened this issue Feb 21, 2023 · 0 comments · Fixed by #1493
Closed

Faraday::ConnectionFailed if proxy: "" is passed on Ruby 3.2.1 #1492

exoego opened this issue Feb 21, 2023 · 0 comments · Fixed by #1493

Comments

@exoego
Copy link
Contributor

exoego commented Feb 21, 2023

Basic Info

  • Faraday Version: 1.10.3 and 2.7.4
  • Ruby Version: 3.2.1
  • adapter: default (net_http)

Issue description

Faraday raises Faraday::ConnectionFailed if proxy: "" is passed to Faraday.new on Ruby 3.2.1.
Same code works for Ruby 2.7.6, Ruby 3.0.0 and Ruby 3.1.3.

Steps to reproduce

Ruby 2.7.6, Ruby 3.0.0 and Ruby 3.1.3:

irb(main):001:0> require "faraday"
=> true
irb(main):002:0> Faraday.new(url: "http://google.com", proxy:"").get.status
=> 301

But in Ruby 3.2.1:

irb(main):006:0> require "faraday"
=> true
irb(main):006:0> Faraday.new(url: "http://google.com", proxy:"").get.status
/Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/net/http.rb:1271:in `initialize': Failed to open TCP connection to :80 (Connection refused - connect(2) for "" port 80) (Faraday::ConnectionFailed)              
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/net/http.rb:1271:in `open'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/net/http.rb:1271:in `block in connect'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/timeout.rb:189:in `block in timeout'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/timeout.rb:196:in `timeout'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/net/http.rb:1269:in `connect'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/net/http.rb:1248:in `do_start'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/3.2.0/net/http.rb:1237:in `start'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-net_http-3.0.2/lib/faraday/adapter/net_http.rb:112:in `request_with_wrapped_block'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-net_http-3.0.2/lib/faraday/adapter/net_http.rb:102:in `perform_request'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-net_http-3.0.2/lib/faraday/adapter/net_http.rb:66:in `block in call'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-2.7.4/lib/faraday/adapter.rb:45:in `connection'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-net_http-3.0.2/lib/faraday/adapter/net_http.rb:65:in `call'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-2.7.4/lib/faraday/request/url_encoded.rb:25:in `call'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-2.7.4/lib/faraday/rack_builder.rb:153:in `build_response'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-2.7.4/lib/faraday/connection.rb:444:in `run_request'
        from /Users/exoego/.asdf/installs/ruby/3.2.1/lib/ruby/gems/3.2.0/gems/faraday-2.7.4/lib/faraday/connection.rb:200:in `get'
        ... 4 levels...```
@exoego exoego changed the title Faraday::ConnectionFailed if proxy: "" is passed Faraday::ConnectionFailed if proxy: "" is passed on Ruby 3.2.1 Feb 21, 2023
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

Successfully merging a pull request may close this issue.

1 participant