-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http: buffer writes even while no socket assigned
PR-URL: #29019 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
- Loading branch information
Showing
3 changed files
with
29 additions
and
3 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
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,19 @@ | ||
// Flags: --expose-internals | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
const { getDefaultHighWaterMark } = require('internal/streams/state'); | ||
|
||
const http = require('http'); | ||
const OutgoingMessage = http.OutgoingMessage; | ||
|
||
const msg = new OutgoingMessage(); | ||
msg._implicitHeader = function() {}; | ||
|
||
// Writes should be buffered until highwatermark | ||
// even when no socket is assigned. | ||
|
||
assert.strictEqual(msg.write('asd'), true); | ||
while (msg.write('asd')); | ||
const highwatermark = msg.writableHighWaterMark || getDefaultHighWaterMark(); | ||
assert(msg.outputSize >= highwatermark); |