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

Doesn't support chunked HTTP/2 responses #2217

Closed
ctoomey opened this Issue Sep 21, 2018 · 3 comments

Comments

Projects
None yet
3 participants
@ctoomey
Copy link
Contributor

ctoomey commented Sep 21, 2018

Chunked HTTP/2 responses are disallowed, and shouldn't be, by the following check in akka.http.scaladsl.model.HttpResponse:

  require(
    protocol == HttpProtocols.`HTTP/1.1` || !entity.isInstanceOf[HttpEntity.Chunked],
    "HTTP/1.0 responses must not have a chunked entity")

The check should instead be

protocol != HttpProtocols.`HTTP/1.0` || !entity.isInstanceOf[HttpEntity.Chunked]
@jrudolph

This comment has been minimized.

Copy link
Member

jrudolph commented Sep 25, 2018

The reasoning is that akka-http2-support can actually handle HttpEntity.Chunked by ignoring the chunk extensions but supporting the trailers using the usual HTTP/2 stream framing.

We already make use of this feature in akka-grpc.

Why does it work there? Because for outgoing responses, akka-http doesn't require that the protocol of a response is set correctly (the protocol field is just ignored).

So, as long as you don't set the protocol of a response to HTTP/2 you can already now use Chunked with HTTP/2.

@jrudolph jrudolph closed this in 8b6a127 Sep 25, 2018

@jrudolph jrudolph added this to the 10.1.6 milestone Sep 25, 2018

@ctoomey

This comment has been minimized.

Copy link
Contributor

ctoomey commented Sep 26, 2018

I needed it to work w/ HTTP/2 protocol as part of an alternate Play integration I'll be proposing separately that involves returning EssentialActions so that Play's Filter chaining support can be leveraged like usual. So the HttpResponse generation from the Result is handled downstream by Play's AkkaHttpServer and it copies the protocol from the request to the response.

@jrudolph

This comment has been minimized.

Copy link
Member

jrudolph commented Sep 26, 2018

Makes sense, thanks for providing the context, @ctoomey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment