You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've got a tool that sends HTTP commands to network devices via their IPv6 address, using the http.rb gem. Things worked as expected until we required resolv-replace.rb to improve proxy support for another feature of our rails application. It looks like by requiring this file in one section, all sockets are injected with the resolver.
Example:
irb(main):012:0> HTTP.get('https://[2620:000e:4000:8890:0000:0000:0101:408a]:443/cgi-bin/test')SocketError: Hostname not known: [2620:000e:4000:8890:0000:0000:0101:408a]from/opt/torquebox/jruby/lib/ruby/1.9/resolv-replace.rb:13:in`getaddress' from /opt/torquebox/jruby/lib/ruby/1.9/resolv-replace.rb:24:in `initialize' from org/jruby/RubyIO.java:1177:in `open'from/opt/rails/vendor/bundle/jruby/1.9/gems/http-0.8.12/lib/http/timeout/null.rb:18:in`connect' from /opt/rails/vendor/bundle/jruby/1.9/gems/http-0.8.12/lib/http/connection.rb:33:in `initialize' from /opt/rails/vendor/bundle/jruby/1.9/gems/http-0.8.12/lib/http/client.rb:65:in `make_request'from/opt/rails/vendor/bundle/jruby/1.9/gems/http-0.8.12/lib/http/client.rb:51:in`perform' from /opt/rails/vendor/bundle/jruby/1.9/gems/http-0.8.12/lib/http/cache/null_cache.rb:9:in `perform' from /opt/rails/vendor/bundle/jruby/1.9/gems/http-0.8.12/lib/http/client.rb:50:in `perform'from/opt/rails/vendor/bundle/jruby/1.9/gems/http-0.8.12/lib/http/client.rb:39:in`request' from /opt/rails/vendor/bundle/jruby/1.9/gems/http-0.8.12/lib/http/chainable.rb:18:in `get' from (irb):14:in `evaluate'fromorg/jruby/RubyKernel.java:1101:in`eval' from org/jruby/RubyKernel.java:1501:in `loop' from org/jruby/RubyKernel.java:1264:in `catch'fromorg/jruby/RubyKernel.java:1264:in`catch' from /opt/rails/vendor/bundle/jruby/1.9/gems/railties-3.2.22/lib/rails/commands/console.rb:47:in `start' from /opt/rails/vendor/bundle/jruby/1.9/gems/railties-3.2.22/lib/rails/commands/console.rb:8:in `start'from/opt/rails/vendor/bundle/jruby/1.9/gems/railties-3.2.22/lib/rails/commands.rb:41:in`(root)' from org/jruby/RubyKernel.java:1065:in `require' from script/rails:6:in `(root)'irb(main):015:0
We were able to fix the error by updating resolv-replace.rb with the following:
class << IPSocket# :stopdoc:aliasoriginal_resolv_getaddressgetaddress# :startdoc:defgetaddress(host)## Start fix## Strip brackets from IPv6 addresses#host=host.to_s.gsub(/\[|\]/,'')## End fix#beginreturnResolv.getaddress(host).to_srescueResolv::ResolvErrorraiseSocketError,"Hostname not known: #{host}"endendend
One possible solution we have is to use DNS to resolve the address of a device, but that will take some time to implement. Is there anything we can do in the short term aside from updating this file? Any help on the matter is much appreciated.
The text was updated successfully, but these errors were encountered:
We've got a tool that sends HTTP commands to network devices via their IPv6 address, using the
http.rb
gem. Things worked as expected until we requiredresolv-replace.rb
to improve proxy support for another feature of our rails application. It looks like by requiring this file in one section, all sockets are injected with the resolver.Example:
We were able to fix the error by updating
resolv-replace.rb
with the following:Definition is here for reference.
One possible solution we have is to use DNS to resolve the address of a device, but that will take some time to implement. Is there anything we can do in the short term aside from updating this file? Any help on the matter is much appreciated.
The text was updated successfully, but these errors were encountered: