HTTP/2 media through Cloudflare
Media sessions now prefer HTTP/2 POST requests to /api in the cfproxy tier,
sharing one TLS connection per DC/domain across clients. This reduces socket
and TLS-handshake overhead for parallel media downloads. Ordinary traffic,
direct WebSockets, Worker tunnels and the configured tier order are unchanged.
- Enabled by default;
--no-h2/TG_NO_H2=truerestores WebSocket media.
Plaintext Cloudflare mode (--cf-disable-tls) continues to use WebSocket. - Uses the shared outbound connector and honors preferred Cloudflare IPs,
domain balancing and certificate verification. - Failed HTTP/2 setup falls back to WebSocket. Failures during a session close
that client connection so Telegram can reconnect. Recent small encrypted
requests have bounded replay for delayed HTTP replies. - Bounds packet sizes, in-flight requests and buffered payloads. HTTP framing
still needs complete packets in memory, so multiplexing trades some buffering
for fewer sockets; it does not promise higher throughput on every network.