File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -1429,6 +1429,10 @@ and will throw an error.
14291429#### ` http2stream.respond([headers[, options]]) `
14301430<!-- YAML
14311431added: v8.4.0
1432+ changes:
1433+ - version: REPLACEME
1434+ pr-url: https://github.com/nodejs/node/pull/33160
1435+ description: Allow explicity setting date headers.
14321436-->
14331437
14341438* ` headers ` {HTTP/2 Headers Object}
@@ -1473,6 +1477,9 @@ server.on('stream', (stream) => {
14731477<!-- YAML
14741478added: v8.4.0
14751479changes:
1480+ - version: REPLACEME
1481+ pr-url: https://github.com/nodejs/node/pull/33160
1482+ description: Allow explicity setting date headers.
14761483 - version: v12.12.0
14771484 pr-url: https://github.com/nodejs/node/pull/29876
14781485 description: The `fd` option may now be a `FileHandle`.
@@ -1571,6 +1578,9 @@ server.on('stream', (stream) => {
15711578<!-- YAML
15721579added: v8.4.0
15731580changes:
1581+ - version: REPLACEME
1582+ pr-url: https://github.com/nodejs/node/pull/33160
1583+ description: Allow explicity setting date headers.
15741584 - version: v10.0.0
15751585 pr-url: https://github.com/nodejs/node/pull/18936
15761586 description: Any readable file, not necessarily a
Original file line number Diff line number Diff line change @@ -2199,7 +2199,10 @@ function processHeaders(oldHeaders) {
21992199 const statusCode =
22002200 headers [ HTTP2_HEADER_STATUS ] =
22012201 headers [ HTTP2_HEADER_STATUS ] | 0 || HTTP_STATUS_OK ;
2202- headers [ HTTP2_HEADER_DATE ] = utcDate ( ) ;
2202+
2203+ if ( headers [ HTTP2_HEADER_DATE ] === null ||
2204+ headers [ HTTP2_HEADER_DATE ] === undefined )
2205+ headers [ HTTP2_HEADER_DATE ] = utcDate ( ) ;
22032206
22042207 // This is intentionally stricter than the HTTP/1 implementation, which
22052208 // allows values between 100 and 999 (inclusive) in order to allow for
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const common = require ( '../common' ) ;
3+ if ( ! common . hasCrypto ) { common . skip ( 'missing crypto' ) ; }
4+ const assert = require ( 'assert' ) ;
5+ const http2 = require ( 'http2' ) ;
6+
7+ const server = http2 . createServer ( common . mustCall ( ( request , response ) => {
8+ response . setHeader ( 'date' , 'snacks o clock' ) ;
9+ response . end ( ) ;
10+ } ) ) ;
11+
12+ server . listen ( 0 , common . mustCall ( ( ) => {
13+ const session = http2 . connect ( `http://localhost:${ server . address ( ) . port } ` ) ;
14+ const req = session . request ( ) ;
15+ req . on ( 'response' , ( headers , flags ) => {
16+ assert . deepStrictEqual ( headers . date , 'snacks o clock' ) ;
17+ } ) ;
18+ req . on ( 'end' , ( ) => {
19+ session . close ( ) ;
20+ server . close ( ) ;
21+ } ) ;
22+ } ) ) ;
You can’t perform that action at this time.
0 commit comments