-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: support readable hwm in IncomingMessage
This commit causes http.IncomingMessage instances to set their readableHighWaterMark value the same value used in the underlying socket. PR-URL: #30135 Fixes: #30107 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
- Loading branch information
1 parent
ba5683c
commit c2757d1
Showing
3 changed files
with
37 additions
and
1 deletion.
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
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,24 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const http = require('http'); | ||
const net = require('net'); | ||
const readableHighWaterMark = 1024; | ||
const server = http.createServer((req, res) => { res.end(); }); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
const req = http.request({ | ||
port: server.address().port, | ||
createConnection(options) { | ||
options.readableHighWaterMark = readableHighWaterMark; | ||
return net.createConnection(options); | ||
} | ||
}, common.mustCall((res) => { | ||
assert.strictEqual(res.socket, req.socket); | ||
assert.strictEqual(res.socket.readableHighWaterMark, readableHighWaterMark); | ||
assert.strictEqual(res.readableHighWaterMark, readableHighWaterMark); | ||
server.close(); | ||
})); | ||
|
||
req.end(); | ||
})); |