httpclient
httpclient copied to clipboard
Test failures with webrick 1.7
We see the tests in httpclient run into timeouts with webrick 1.7.0. I was able to track it down to this line in lib/httpclient/session.rb:
799 StatusParseRegexp = %r(\AHTTP/(\d+\.\d+)\s+(\d\d\d)\s*([^\r\n]+)?\r?\n\z)
800 def parse_header(socket)
801 ::Timeout.timeout(@receive_timeout, ReceiveTimeoutError) do
802 initial_line = nil
803 begin
804 begin
=> 805 initial_line = socket.gets("\n")
806 if initial_line.nil?
807 close
808 raise KeepAliveDisconnected.new(self)
809 end
810 rescue Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE, IOError
Here it "stalls". The problem is caused by this small change in webrick:
https://github.com/ruby/webrick/commit/069e9b1908aad3a30a0dcf67b6d3bb13c3216d2c
I have just been informed by a colleague that the commit has been reverted in webrick: https://github.com/ruby/webrick/issues/67, but there is not yet a new version of it. So you'll probably try to stay clear of version 1.7.0.
Thanks for noting this! I was running the tests on Ruby 3.0 to test compatibility with that version of Ruby, and the tests pass when I add Webrick 1.6.1 to the Gemfile. So I guess it's compatible with Ruby 3.0 even though it hasn't been updated in a while.
webrick-1.8.0 and webrick-1.8.1 have been released in the meantime.