Skip to content

Commit 7cd36d1

Browse files
authored
Mark http/2 support as stable (#3893)
Signed-off-by: Matteo Collina <[email protected]>
1 parent 1cfe094 commit 7cd36d1

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

docs/docs/api/Client.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ Returns: `Client`
1717

1818
### Parameter: `ClientOptions`
1919

20-
> ⚠️ Warning: The `H2` support is experimental.
21-
2220
* **bodyTimeout** `number | null` (optional) - Default: `300e3` - The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Defaults to 300 seconds. Please note the `timeout` will be reset if you keep writing data to the socket everytime.
2321
* **headersTimeout** `number | null` (optional) - Default: `300e3` - The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers while not sending the request. Defaults to 300 seconds.
2422
* **keepAliveMaxTimeout** `number | null` (optional) - Default: `600e3` - The maximum allowed `keepAliveTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Defaults to 10 minutes.
@@ -34,6 +32,17 @@ Returns: `Client`
3432
* **allowH2**: `boolean` - Default: `false`. Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation.
3533
* **maxConcurrentStreams**: `number` - Default: `100`. Dictates the maximum number of concurrent streams for a single H2 session. It can be overridden by a SETTINGS remote frame.
3634

35+
> **Notes about HTTP/2**
36+
> - It only works under TLS connections. h2c is not supported.
37+
> - The server must support HTTP/2 and choose it as the protocol during the ALPN negotiation.
38+
> - The server must not have a bigger priority for HTTP/1.1 than HTTP/2.
39+
> - Pseudo headers are automatically attached to the request. If you try to set them, they will be overwritten.
40+
> - The `:path` header is automatically set to the request path.
41+
> - The `:method` header is automatically set to the request method.
42+
> - The `:scheme` header is automatically set to the request scheme.
43+
> - The `:authority` header is automatically set to the request `host[:port]`.
44+
> - `PUSH` frames are yet not supported.
45+
3746
#### Parameter: `ConnectOptions`
3847

3948
Every Tls option, see [here](https://nodejs.org/api/tls.html#tls_tls_connect_options_callback).

lib/dispatcher/client-h2.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ const kOpenStreams = Symbol('open streams')
3535

3636
let extractBody
3737

38-
// Experimental
39-
let h2ExperimentalWarned = false
40-
4138
/** @type {import('http2')} */
4239
let http2
4340
try {
@@ -82,13 +79,6 @@ function parseH2Headers (headers) {
8279
async function connectH2 (client, socket) {
8380
client[kSocket] = socket
8481

85-
if (!h2ExperimentalWarned) {
86-
h2ExperimentalWarned = true
87-
process.emitWarning('H2 support is experimental, expect them to change at any time.', {
88-
code: 'UNDICI-H2'
89-
})
90-
}
91-
9282
const session = http2.connect(client[kUrl], {
9383
createConnection: () => socket,
9484
peerMaxConcurrentStreams: client[kMaxConcurrentStreams],

0 commit comments

Comments
 (0)