-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 HTTP/2 push support to Server #1586
Comments
First step is that the h2 dependency would need Push support: hyperium/h2#291 |
With
An example using this proposal looks like this: async fn handle(mut req: Request<Body>) -> Result<Response<Body>, E> {
match hyper::push::pusher(&mut req) {
Ok(mut pusher) => {
let promise = Request::builder()
.uri("/app.js")
.body(())
.unwrap();
if let Err(e) = pusher.push_request(promise).await {
eprintln!("push failed: {}", e);
}
},
Err(e) => eprintln!("http2 pusher unavailable: {}", e),
}
Ok(Response::new(index_page_stream()))
} |
@stammw would the proposed API make sense for HTTP 3? |
I was waiting to figure out a first implementation of push streams for
I have a limited knowledge of Hyper for now, so I hope this helps! |
UPDATE: |
@seanmonstar I'm happy to take a look at this, but I'm not sure about the proposed API. In particular:
Clients can disable (and reenable) server push at any point during the life of a connection, by sending updated settings. Therefore this design could create a race hazard, where a Would it not be better simply to always permit push attempts (i.e. without any |
Hm, that's a fair point. I think, however, that we'd need to consider the likelihood of different scenarios happening. I believe it would be uncommon for clients to enable and disable push promises mid-connection. Even if they do, it should be very rare for that to happen with each request. I do think servers may want to know if pushes would even possible be accepted before starting to create Then again, one option is to allow "pushing" even with HTTP/1.1, and in that case, sending |
Is this still waiting? |
What is the state of HTTP/2 server push in hyper? I couldn't find anything in the documentation. Are there any plans to implement it in the future?
The text was updated successfully, but these errors were encountered: