Skip to content

Support handling Enumerator for non-buffered responses#49616

Merged
rafaelfranca merged 1 commit intorails:mainfrom
zzak:49588
Oct 13, 2023
Merged

Support handling Enumerator for non-buffered responses#49616
rafaelfranca merged 1 commit intorails:mainfrom
zzak:49588

Conversation

@zzak
Copy link
Copy Markdown
Member

@zzak zzak commented Oct 13, 2023

The downside to this is that we cannot generate ETags for these types of responses, but are assuming that by using an enumerator they don't expect a buffered response to be cacheable. This means you cannot use Enumerator to generate streaming responses.

Fixes #49588

See also: #47092

The downside to this is that we cannot generate ETags for these types of responses, but are assuming that by using an enumerator they don't expect a buffered response to be cacheable. This means you cannot use Enumerator to generate streaming responses.

Fixes rails#49588

See also: rails#47092

Co-authored-by: Samuel Williams <samuel.williams@oriontransfer.co.nz>
@rails-bot rails-bot bot added the actionpack label Oct 13, 2023
@rafaelfranca rafaelfranca merged commit 33b1976 into rails:main Oct 13, 2023
rafaelfranca added a commit that referenced this pull request Oct 13, 2023
Support handling Enumerator for non-buffered responses
@zzak zzak deleted the 49588 branch October 13, 2023 16:17
zzak added a commit to zzak/rails that referenced this pull request Oct 13, 2023
There is an inherit complexity with wrapping the Rack body inside Rails which can lead to bugs, like rails#49588.

While rails#49616 fixed the bug, it's probably not a good long-term solution.

If we go all the way back to 6a89850, we can see this was the original behavior. However, we were trying to solve a separate issue with streaming bodies during disconnect.

The `live_stream_test#test_abort_with_full_buffer` test fails in this PR, but I wanted to raise that maybe this could be handled a different way.

Also there are two failures in `response_test` which are questions to me:

* `ResponseTest#test_[response.to_a].flatten_does_not_recurse_infinitely`
* `ResponseTest#test_compatibility_with_Rack::ContentLength`

The first seems it is actually resolved upstream, per this comment:
rails#47092 (comment)

The second means we broke `Rack::ContentLength` and there is a bit on this in rails#44953.

FWIW: I'm not proposing this PR exactly, but looking for a path forward and would love some feedback. 🙇
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rails 7.1 breaks ActionDispatch Enumerator Handling

2 participants