ostinelli / net-http2

NetHttp2 is an HTTP/2 client for Ruby.
MIT License
141 stars 31 forks source link

TypeError: no implicit conversion of nil into String #18

Open blkperl opened 7 years ago

blkperl commented 7 years ago

It appears that net-http2 can trigger a TypeError for some servers.

Expected Behavior

Socket Error as server is not running HTTP2

Actual Behavior

TypeError

Steps to reproduce

[1] pry(main)> require 'net-http2'
=> true
[2] pry(main)> client = NetHttp2::Client.new("https://cloud.acquia.com")
=> #<NetHttp2::Client:0x007fcaa5a87420
 @connect_timeout=60,
 @first_data_sent=false,
 @h2=nil,
 @is_ssl=true,
 @mutex=#<Thread::Mutex:0x007fcaa5a87100>,
 @socket=nil,
 @socket_thread=nil,
 @ssl_context=
  #<OpenSSL::SSL::SSLContext:0x007fcaa5a87218
   @npn_protocols=["h2"],
   @npn_select_cb=#<Proc:0x007fcaa5a87150@/Users/REDACTED/.rvm/gems/ruby-2.4.0/gems/net-http2-0.15.0/lib/net-http2/client.rb:174 (lambda)>>,
 @streams={},
 @uri=#<URI::HTTPS https://cloud.acquia.com>>
[3] pry(main)> response = client.call(:get, '/')
TypeError: no implicit conversion of nil into String
from /Users/REDACTED/.rvm/gems/ruby-2.4.0/gems/net-http2-0.15.0/lib/net-http2/socket.rb:23:in `connect'

You can trigger the same bug with https://console.aws.amazon.com