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

Exception: NoMethodError: undefined method `include?' for nil - in lib/net/http.rb:2466 #184

Open
rgaufman opened this issue Sep 12, 2024 · 1 comment

Comments

@rgaufman
Copy link

I'm getting:

Exception: NoMethodError: undefined method `include?' for nil

Here:

vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:2466:in `addr_port'
vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:2401:in `begin_transport'
vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:2332:in `transport_request'
vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:2306:in `request'
vendor/bundle/ruby/3.3.0/gems/airbrake-13.0.4/lib/airbrake/rails/net_http.rb:11:in `block in request'
vendor/bundle/ruby/3.3.0/gems/airbrake-13.0.4/lib/airbrake/rack.rb:21:in `capture_timing'
vendor/bundle/ruby/3.3.0/gems/airbrake-13.0.4/lib/airbrake/rails/net_http.rb:10:in `request'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:112:in `block in request_with_wrapped_block'
vendor/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:1570:in `start'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:111:in `request_with_wrapped_block'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:101:in `perform_request'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:65:in `block in call'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/adapter.rb:45:in `connection'
vendor/bundle/ruby/3.3.0/gems/faraday-net_http-3.3.0/lib/faraday/adapter/net_http.rb:64:in `call'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/middleware.rb:56:in `call'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/rack_builder.rb:152:in `build_response'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/connection.rb:452:in `run_request'
vendor/bundle/ruby/3.3.0/gems/faraday-2.11.0/lib/faraday/connection.rb:200:in `get'

This is the code responsible:

    def addr_port
      addr = address
      addr = "[#{addr}]" if addr.include?(":") # the .include? here
      default_port = use_ssl? ? HTTP.https_default_port : HTTP.http_default_port
      default_port == port ? addr : "#{addr}:#{port}"
    end

It seems there should be some kind of validation earlier to avoid this?

@hsbt
Copy link
Member

hsbt commented Sep 13, 2024

That method is not changed while 7 years. What's input for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants