Feature #8155
Improve support for streaming responses in WEBrick
Description
Currently WEBrick only understands a body that is a String or an IO. This makes it difficult to stream a response body. Instead of providing a body that duck-types to IO you must use IO.pipe which can be clumsy.
The attached patch checks if the body responds to #readpartial (#read is assumed) instead of if it is an instance of class IO.
Associated revisions
- lib/webrick/httpresponse.rb: Allow #body to be an IO-like object that responds to #readpartial and #read. [ruby-trunk - Feature #8155]
- NEWS: NEWS for above
- test/webrick/test_httpresponse.rb: Tests for above.
- lib/webrick/httpresponse.rb: Allow #body to be an IO-like object that responds to #readpartial and #read. [ruby-trunk - Feature #8155]
- NEWS: NEWS for above
- test/webrick/test_httpresponse.rb: Tests for above.
- lib/webrick/httpresponse.rb: Allow #body to be an IO-like object that responds to #readpartial and #read. [ruby-trunk - Feature #8155]
- NEWS: NEWS for above
- test/webrick/test_httpresponse.rb: Tests for above.
- lib/webrick/httpresponse.rb: Allow #body to be an IO-like object that responds to #readpartial and #read. [ruby-trunk - Feature #8155]
- NEWS: NEWS for above
- test/webrick/test_httpresponse.rb: Tests for above.
- lib/webrick/httpresponse.rb: Allow #body to be an IO-like object that responds to #readpartial and #read. [ruby-trunk - Feature #8155]
- NEWS: NEWS for above
- test/webrick/test_httpresponse.rb: Tests for above.
History
#1
[ruby-core:56420]
Updated by drbrain (Eric Hodel) over 4 years ago
- Assignee changed from nahi (Hiroshi Nakamura) to drbrain (Eric Hodel)
assigning to me per: http://twitter.com/nahi/status/364910788529500160
#2
Updated by drbrain (Eric Hodel) over 4 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r42427.
Eric, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- lib/webrick/httpresponse.rb: Allow #body to be an IO-like object that responds to #readpartial and #read. [ruby-trunk - Feature #8155]
- NEWS: NEWS for above
- test/webrick/test_httpresponse.rb: Tests for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42427 b2dd03c8-39d4-4d8f-98ff-823fe69b080e