[#85349] [Ruby trunk Bug#14334] Segmentation fault after running rspec (ruby/2.5.0/erb.rb:885 / simplecov/source_file.rb:85) — pragtob@...
Issue #14334 has been updated by PragTob (Tobias Pfeiffer).
3 messages
2018/02/02
[#85358] Re: [ruby-cvs:69220] nobu:r62039 (trunk): compile.c: unnecessary freezing — Eric Wong <normalperson@...>
nobu@ruby-lang.org wrote:
5 messages
2018/02/03
[#85612] Why require autoconf 2.67+ — leam hall <leamhall@...>
Please pardon the intrusion; I am new to Ruby and like to pull the
6 messages
2018/02/17
[#85634] [Ruby trunk Bug#14494] [PATCH] tool/m4/ruby_replace_type.m4 use AC_CHECK_TYPES for HAVE_* macros — normalperson@...
Issue #14494 has been reported by normalperson (Eric Wong).
3 messages
2018/02/19
[#85674] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — matz@...
Issue #13618 has been updated by matz (Yukihiro Matsumoto).
5 messages
2018/02/20
[#85686] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2018/02/20
matz@ruby-lang.org wrote:
[#85704] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Koichi Sasada <ko1@...>
2018/02/21
On 2018/02/20 18:06, Eric Wong wrote:
[ruby-core:85414] [Ruby trunk Bug#14451] HTTP responses with Content-Length: 0 cause a failure
From:
jdshewey@...
Date:
2018-02-05 19:07:20 UTC
List:
ruby-core #85414
Issue #14451 has been reported by jdshewey (James Shewey).
----------------------------------------
Bug #14451: HTTP responses with Content-Length: 0 cause a failure
https://bugs.ruby-lang.org/issues/14451
* Author: jdshewey (James Shewey)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.0.0p648
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
When a web server responds with a 200 OK without a body, if read_timeout is not set to nil, a Net::Timeout exception is thrown after 60 seconds. This is because ruby is stuck looping in rbuf_fill (https://github.com/ruby/ruby/blob/814daf855e0aa2c3a1164dc765378d3a092a1825/lib/net/protocol.rb) trying to read a response that will never come (or more precisely has already come in the header; there is no body to be read).
According to the RFC for JSON, for example (RFC7231 https://tools.ietf.org/html/rfc7231#section-6.3.1) a 0 content-length is a perfectly valid JSON response:
~~~
Aside from responses to CONNECT, a 200 response always has a payload,
though an origin server MAY generate a payload body of zero length.
~~~
I encountered this issue via the rest-client library and it appears that read_timeout is passed upstream to Net::HTTP. It can be reproduced with the following script:
~~~ ruby
require 'rest-client'
result = RestClient::Request.execute(method: :post, url: 'http:/mywebserver.com/', payload: {testkey: 'testvalue'}, headers: {accept: :json}, timeout: nil)
puts result.body
~~~
You would then need to configure the webserver to return a response with no body and a content-length of zero. I would suggest that Net:HTTP should check the response header for a content-length of zero and skip attempts to read the body in this event.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>