-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `sendDate` flag was not being respected by the current implementation and the `Date` header was being sent regardless of the config. This commit fixes that and adds tests for this case. Fixes: #34841 PR-URL: #34850 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Ricky Zhou <[email protected]> Reviewed-By: Denys Otrishko <[email protected]> Reviewed-By: Rich Trott <[email protected]>
- Loading branch information
1 parent
4b3b0e3
commit cc72584
Showing
4 changed files
with
49 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
test/parallel/test-http2-compat-serverresponse-headers-send-date.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
if (!common.hasCrypto) { common.skip('missing crypto'); } | ||
const assert = require('assert'); | ||
const http2 = require('http2'); | ||
|
||
const server = http2.createServer(common.mustCall((request, response) => { | ||
response.sendDate = false; | ||
response.writeHead(200); | ||
response.end(); | ||
})); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
const session = http2.connect(`http://localhost:${server.address().port}`); | ||
const req = session.request(); | ||
|
||
req.on('response', common.mustCall((headers, flags) => { | ||
assert.strictEqual('Date' in headers, false); | ||
assert.strictEqual('date' in headers, false); | ||
})); | ||
|
||
req.on('end', common.mustCall(() => { | ||
session.close(); | ||
server.close(); | ||
})); | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters