1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//! # h2ts-client
//!
//! A from-scratch HTTP/2 client (RFC 7540 + HPACK/RFC 7541) for **Rust WASM
//! frontends**, tunneled over a WebSocket — the Rust sibling of the TypeScript
//! [`h2ts`] client. It deliberately avoids `hyper`/`tokio` so it stays tiny in a
//! `wasm32` bundle: a **sans-I/O protocol engine** plus a pluggable [`Transport`].
//! HTTP/2 is spoken with prior knowledge (no HTTP/1.1 `Upgrade` round-trip).
//!
//! The protocol engine is a module-for-module port of the TypeScript client
//! (`typescript/client/src`). Both clients conform to one wire spec
//! (`spec/protocol.md`) and the shared conformance suite (`conformance/`) — that
//! shared *behaviour*, not shared code, is what keeps them from diverging.
//!
//! | module | ports from (TS) | responsibility |
//! |-----------------|---------------------|----------------------------------------|
//! | [`frames`] | `frames/` | HTTP/2 frame codec |
//! | [`hpack`] | `hpack/` | HPACK encoder + decoder |
//! | [`flow`] | `flow.ts` | connection/stream flow control |
//! | [`connection`] | `connection.ts` | multiplexer, request/response flow |
//! | [`transport`] | `transport/` | the pluggable byte-duplex |
//!
//! The default `web` feature provides a browser `WebSocket` [`Transport`] via
//! `web-sys`; disable it for host-side engine tests.
//!
//! Terminate the WebSocket with the Rust server [`h2ts-server`] (its `h2ts-proxy`
//! binary, or `websockify`) to reach any HTTP/2 origin.
//!
//! [`h2ts`]: https://www.npmjs.com/package/@debdattabasu/h2ts
//! [`h2ts-server`]: https://crates.io/crates/h2ts-server
/// The WebSocket subprotocol an h2ts client offers by default (echoed by the
/// gateway). Offer it first; see `spec/protocol.md`.
pub const DEFAULT_SUBPROTOCOL: &str = "h2ts";
pub use ;
pub use ;
pub use Header;
pub use ;
pub use ;
// Browser WebSocket transport — wasm32 only, behind the default `web` feature.
pub use ;