File tree 3 files changed +36
-1
lines changed
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.
1429
1429
#### ` http2stream.respond([headers[, options]]) `
1430
1430
<!-- YAML
1431
1431
added: 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.
1432
1436
-->
1433
1437
1434
1438
* ` headers ` {HTTP/2 Headers Object}
@@ -1473,6 +1477,9 @@ server.on('stream', (stream) => {
1473
1477
<!-- YAML
1474
1478
added: v8.4.0
1475
1479
changes:
1480
+ - version: REPLACEME
1481
+ pr-url: https://github.com/nodejs/node/pull/33160
1482
+ description: Allow explicity setting date headers.
1476
1483
- version: v12.12.0
1477
1484
pr-url: https://github.com/nodejs/node/pull/29876
1478
1485
description: The `fd` option may now be a `FileHandle`.
@@ -1571,6 +1578,9 @@ server.on('stream', (stream) => {
1571
1578
<!-- YAML
1572
1579
added: v8.4.0
1573
1580
changes:
1581
+ - version: REPLACEME
1582
+ pr-url: https://github.com/nodejs/node/pull/33160
1583
+ description: Allow explicity setting date headers.
1574
1584
- version: v10.0.0
1575
1585
pr-url: https://github.com/nodejs/node/pull/18936
1576
1586
description: Any readable file, not necessarily a
Original file line number Diff line number Diff line change @@ -2199,7 +2199,10 @@ function processHeaders(oldHeaders) {
2199
2199
const statusCode =
2200
2200
headers [ HTTP2_HEADER_STATUS ] =
2201
2201
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 ( ) ;
2203
2206
2204
2207
// This is intentionally stricter than the HTTP/1 implementation, which
2205
2208
// 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