Skip to main content

netget/server/http2/
push.rs

1//! HTTP/2 server push — the one type the server actually uses.
2//!
3//! `push_resource` (`actions.rs`) turns a model action into a JSON directive tagged
4//! `_push_directive`; `handle_h2_request` (`h2_server.rs`) decodes each one into a
5//! [`PendingPush`] and sends the PUSH_PROMISE + push stream inline, before the main
6//! response, because `h2` requires the promise on the parent stream's `SendResponse`.
7//!
8//! This module used to also carry a `PushManager` (queue + `execute_pushes`) and an
9//! mpsc `PushChannel`/`PushReceiver` pair. Nothing ever drove them: `handle_h2_request`
10//! constructed a `PushManager`, cloned it into a binding named `_push_manager_clone`,
11//! and then did the pushing itself; `create_push_channel` had no callers at all. They
12//! are removed rather than kept, because a queue that looks like the push path but is
13//! never on it is exactly the trap the second, never-spawned `Http2Server` was (see
14//! `src/server/http2/CLAUDE.md`).
15
16use std::collections::HashMap;
17
18/// One resource the model asked to push alongside the current response.
19#[derive(Debug, Clone)]
20pub struct PendingPush {
21    pub path: String,
22    pub method: String,
23    pub status: u16,
24    pub headers: HashMap<String, String>,
25    pub body: Vec<u8>,
26}