net-http2 icon indicating copy to clipboard operation
net-http2 copied to clipboard

Socket was remotely closed (SocketError)

Open jan opened this issue 3 years ago • 1 comments

The basic synchronous call from the README works, but it breaks when I change the host from nghttp2.org to the one that i actually want to request from:

# create a client
# client = NetHttp2::Client.new("http://nghttp2.org") # <- works
client = NetHttp2::Client.new("http://httpbin.org") # <- does not work; same with other hosts

# send request
response = client.call(:get, '/')

# ...
#<Thread:0x00007f95a592c4e8@/Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:112 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
	5: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:114:in `block (2 levels) in ensure_open'
	4: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:142:in `socket_loop'
	3: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:142:in `loop'
	2: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:145:in `block in socket_loop'
	1: from <internal:prelude>:73:in `read_nonblock'
<internal:prelude>:73:in `__read_nonblock': end of file reached (EOFError)
	2: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:113:in `block (2 levels) in ensure_open'
	1: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:119:in `rescue in block (2 levels) in ensure_open'
/Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:134:in `callback_or_raise': Socket was remotely closed (SocketError)
Traceback (most recent call last):
	5: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:114:in `block (2 levels) in ensure_open'
	4: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:142:in `socket_loop'
	3: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:142:in `loop'
	2: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:145:in `block in socket_loop'
	1: from <internal:prelude>:73:in `read_nonblock'
<internal:prelude>:73:in `__read_nonblock': end of file reached (EOFError)
	2: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:113:in `block (2 levels) in ensure_open'
	1: from /Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:119:in `rescue in block (2 levels) in ensure_open'
/Library/Ruby/Gems/2.6.0/gems/net-http2-0.18.4/lib/net-http2/client.rb:134:in `callback_or_raise': Socket was remotely closed (SocketError)

MacOS 10.15.7 ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]

jan avatar Oct 07 '22 14:10 jan

Are you sure you don't have network problems or your ip is blacklisted or something? Works for me and probably for many other people with random HTTP2 enabled web servers.

akostadinov avatar Nov 18 '23 22:11 akostadinov