@@ -2278,7 +2278,7 @@ not work.
2278
2278
For incoming headers:
2279
2279
* The ` :status ` header is converted to ` number ` .
2280
2280
* Duplicates of ` :status ` , ` :method ` , ` :authority ` , ` :scheme ` , ` :path ` ,
2281
- ` age ` , ` authorization ` , ` access-control-allow-credentials ` ,
2281
+ ` :protocol ` , ` age ` , ` authorization ` , ` access-control-allow-credentials ` ,
2282
2282
` access-control-max-age ` , ` access-control-request-method ` , ` content-encoding ` ,
2283
2283
` content-language ` , ` content-length ` , ` content-location ` , ` content-md5 ` ,
2284
2284
` content-range ` , ` content-type ` , ` date ` , ` dnt ` , ` etag ` , ` expires ` , ` from ` ,
@@ -2335,6 +2335,10 @@ properties.
2335
2335
* ` maxHeaderListSize ` {number} Specifies the maximum size (uncompressed octets)
2336
2336
of header list that will be accepted. The minimum allowed value is 0. The
2337
2337
maximum allowed value is 2<sup >32</sup >-1. ** Default:** ` 65535 ` .
2338
+ * ` enableConnectProtocol ` {boolean} Specifies ` true ` if the "Extended Connect
2339
+ Protocol" defined by [ RFC 8441] [ ] is to be enabled. This setting is only
2340
+ meaningful if sent by the server. Once the ` enableConnectProtocol ` setting
2341
+ has been enabled for a given ` Http2Session ` , it cannot be disabled.
2338
2342
2339
2343
All additional properties on the settings object are ignored.
2340
2344
@@ -2501,6 +2505,36 @@ req.on('end', () => {
2501
2505
req .end (' Jane' );
2502
2506
```
2503
2507
2508
+ ### The Extended CONNECT Protocol
2509
+
2510
+ [ RFC 8441] [ ] defines an "Extended CONNECT Protocol" extension to HTTP/2 that
2511
+ may be used to bootstrap the use of an ` Http2Stream ` using the ` CONNECT `
2512
+ method as a tunnel for other communication protocols (such as WebSockets).
2513
+
2514
+ The use of the Extended CONNECT Protocol is enabled by HTTP/2 servers by using
2515
+ the ` enableConnectProtocol ` setting:
2516
+
2517
+ ``` js
2518
+ const http2 = require (' http2' );
2519
+ const settings = { enableConnectProtocol: true };
2520
+ const server = http2 .createServer ({ settings });
2521
+ ```
2522
+
2523
+ Once the client receives the ` SETTINGS ` frame from the server indicating that
2524
+ the extended CONNECT may be used, it may send ` CONNECT ` requests that use the
2525
+ ` ':protocol' ` HTTP/2 pseudo-header:
2526
+
2527
+ ``` js
2528
+ const http2 = require (' http2' );
2529
+ const client = http2 .connect (' http://localhost:8080' );
2530
+ client .on (' remoteSettings' , (settings ) => {
2531
+ if (settings .enableConnectProtocol ) {
2532
+ const req = client .request ({ ' :method' : ' CONNECT' , ' :protocol' : ' foo' });
2533
+ // ...
2534
+ }
2535
+ });
2536
+ ```
2537
+
2504
2538
## Compatibility API
2505
2539
2506
2540
The Compatibility API has the goal of providing a similar developer experience
@@ -3361,6 +3395,7 @@ following additional properties:
3361
3395
[ Readable Stream ] : stream.html#stream_class_stream_readable
3362
3396
[ RFC 7838 ] : https://tools.ietf.org/html/rfc7838
3363
3397
[ RFC 8336 ] : https://tools.ietf.org/html/rfc8336
3398
+ [ RFC 8441 ] : https://tools.ietf.org/html/rfc8441
3364
3399
[ Using `options.selectPadding()` ] : #http2_using_options_selectpadding
3365
3400
[ `'checkContinue'` ] : #http2_event_checkcontinue
3366
3401
[ `'request'` ] : #http2_event_request
0 commit comments