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

Http/2 Push Promise support - Jetty backend #8

Open
etspaceman opened this issue Mar 16, 2021 · 7 comments
Open

Http/2 Push Promise support - Jetty backend #8

etspaceman opened this issue Mar 16, 2021 · 7 comments
Labels
enhancement New feature or request module:servlet

Comments

@etspaceman
Copy link

Jetty supports Push Promises today for Http2 servers. I was in need of this for a project of my own but it doesn't seem that the current Jetty backend supports this today. Created per a conversation w/ @ChristopherDavenport .

@rossabaker
Copy link
Member

To make this happen, I think we'd need to understand how they're implemented via a servlet model, and then consider an abstraction that would also fit nicely with forthcoming Ember support. Vault attributes are probably the answer here.

@ScalaWilliam
Copy link

ScalaWilliam commented Mar 18, 2021

@rossabaker
Copy link
Member

Interesting. Looks like this delegates to Jetty APIs, rather than being a raw servlet solution. That's probably fine, but has impacts on where it lives if we build on it.

@rossabaker
Copy link
Member

I also thought these APIs would be part of Servlet 4/5. I need to make time to read those. The difference between 4 and 5 is the package namespace, but I thought this was a new feature.

@rossabaker rossabaker added enhancement New feature or request module:servlet labels Apr 12, 2021
@rossabaker rossabaker transferred this issue from http4s/http4s Apr 14, 2022
@ChristopherDavenport
Copy link
Member

To be clear, this is the api I decided on for Embers h2 push promise support.

https://github.com/http4s/http4s/blob/series/0.23/ember-core/shared/src/main/scala/org/http4s/ember/core/h2/H2Keys.scala#L28-L29 - This attaches to a response to push requests out at the same time.

Then in the client, https://github.com/http4s/http4s/blob/series/0.23/ember-client/shared/src/main/scala/org/http4s/ember/client/EmberClientBuilder.scala#L214

It may not be ideal. But its something to work from as a baseline for design.

@etspaceman
Copy link
Author

Ok - that looks like interesting progress for clients. Do you have any thoughts on server support for this?

@ChristopherDavenport
Copy link
Member

ChristopherDavenport commented Apr 14, 2022

Ember Server Supports this using that H2Key list there.

So Basically

Response[F](Status.Ok)
  .withAttribute(H2Keys.PushPromises, Request[Pure](Method.GET, uri"/foo") :: Nil)

The server then returns that request as a push promise frame, and the server runs that request against its internal routes to generate a response to send normally to the push promises stream identifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module:servlet
Projects
None yet
Development

No branches or pull requests

4 participants