Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add status the 103 Early Hints as Not content for action_dispatch #39417

Merged
merged 1 commit into from May 26, 2020

Conversation

roramirez
Copy link
Contributor

The status is defined in RFC 8297 https://tools.ietf.org/html/rfc8297

@rails-bot rails-bot bot added the actionpack label May 25, 2020
@eugeneius
Copy link
Member

How can this be used in practice? If I understand correctly, an Early Hints response should be followed by another full response over the same connection, but ActionDispatch::Response manages a single response that's eventually sent by Rack.

@eugeneius
Copy link
Member

Although I guess that argument applies to anything in the 1xx range.

Recent versions of Rack support sending this status: rack/rack#1332

I'll merge, thanks!

@eugeneius eugeneius merged commit a47e0c1 into rails:master May 26, 2020
@roramirez
Copy link
Contributor Author

Hi @eugeneius

Maybe should we'll try prepare a test case using a response and reply for the 103 Early Hints, as more a behavior for the case, not just a unit test case.

What do you think?, I'll could try figure out how to match to this point with a test

@eugeneius
Copy link
Member

I don't doubt that Rails is capable of serving a properly formed 103 Early Hints response, I just can't see how that would be a useful thing to do in a real application.

From a quick test: if I call head :early_hints in a controller, Chrome receives the response, waits 20 more seconds, and then displays an error page with the code ERR_EMPTY_RESPONSE.

This also happens when using head :switching_protocols, for example, which is why I merged this: I think the HTTP protocol is an area where it makes sense for Rails to aim for completeness even if there isn't an immediately obvious benefit of doing so.

If you had a particular use case in mind for this though, please do tell me about it. 🙂

@eugeneius
Copy link
Member

Incidentally, Puma supports sending early hints before the main response: puma/puma#1403

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.

None yet

2 participants