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 @@ -1409,6 +1409,10 @@ and will throw an error.
1409
1409
#### ` http2stream.respond([headers[, options]]) `
1410
1410
<!-- YAML
1411
1411
added: v8.4.0
1412
+ changes:
1413
+ - version: REPLACEME
1414
+ pr-url: https://github.com/nodejs/node/pull/33160
1415
+ description: Allow explicity setting date headers.
1412
1416
-->
1413
1417
1414
1418
* ` headers ` {HTTP/2 Headers Object}
@@ -1453,6 +1457,9 @@ server.on('stream', (stream) => {
1453
1457
<!-- YAML
1454
1458
added: v8.4.0
1455
1459
changes:
1460
+ - version: REPLACEME
1461
+ pr-url: https://github.com/nodejs/node/pull/33160
1462
+ description: Allow explicity setting date headers.
1456
1463
- version: v12.12.0
1457
1464
pr-url: https://github.com/nodejs/node/pull/29876
1458
1465
description: The `fd` option may now be a `FileHandle`.
@@ -1551,6 +1558,9 @@ server.on('stream', (stream) => {
1551
1558
<!-- YAML
1552
1559
added: v8.4.0
1553
1560
changes:
1561
+ - version: REPLACEME
1562
+ pr-url: https://github.com/nodejs/node/pull/33160
1563
+ description: Allow explicity setting date headers.
1554
1564
- version: v10.0.0
1555
1565
pr-url: https://github.com/nodejs/node/pull/18936
1556
1566
description: Any readable file, not necessarily a
Original file line number Diff line number Diff line change @@ -2222,7 +2222,10 @@ function processHeaders(oldHeaders) {
2222
2222
const statusCode =
2223
2223
headers [ HTTP2_HEADER_STATUS ] =
2224
2224
headers [ HTTP2_HEADER_STATUS ] | 0 || HTTP_STATUS_OK ;
2225
- headers [ HTTP2_HEADER_DATE ] = utcDate ( ) ;
2225
+
2226
+ if ( headers [ HTTP2_HEADER_DATE ] === null ||
2227
+ headers [ HTTP2_HEADER_DATE ] === undefined )
2228
+ headers [ HTTP2_HEADER_DATE ] = utcDate ( ) ;
2226
2229
2227
2230
// This is intentionally stricter than the HTTP/1 implementation, which
2228
2231
// 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