| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e8bb1f7 commit a9a2dd3
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -819,17 +819,18 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) { | |||
| 819 | 819 | encoding = null; | |
| 820 | 820 | } | |
| 821 | 821 | ||
| 822 | - if (this.socket) { | ||
| 823 | - this.socket.cork(); | ||
| 824 | - } | ||
| 825 | - | ||
| 826 | 822 | if (chunk) { | |
| 827 | 823 | if (this.finished) { | |
| 828 | 824 | onError(this, | |
| 829 | 825 | new ERR_STREAM_WRITE_AFTER_END(), | |
| 830 | 826 | typeof callback !== 'function' ? nop : callback); | |
| 831 | 827 | return this; | |
| 832 | 828 | } | |
| 829 | + | ||
| 830 | + if (this.socket) { | ||
| 831 | + this.socket.cork(); | ||
| 832 | + } | ||
| 833 | + | ||
| 833 | 834 | write_(this, chunk, encoding, null, true); | |
| 834 | 835 | } else if (this.finished) { | |
| 835 | 836 | if (typeof callback === 'function') { | |
@@ -841,6 +842,10 @@ OutgoingMessage.prototype.end = function end(chunk, encoding, callback) { | |||
| 841 | 842 | } | |
| 842 | 843 | return this; | |
| 843 | 844 | } else if (!this._header) { | |
| 845 | + if (this.socket) { | ||
| 846 | + this.socket.cork(); | ||
| 847 | + } | ||
| 848 | + | ||
| 844 | 849 | this._contentLength = 0; | |
| 845 | 850 | this._implicitHeader(); | |
| 846 | 851 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,10 +9,13 @@ const onWriteAfterEndError = common.mustCall((err) => { | |||
| 9 | 9 | ||
| 10 | 10 | const server = http.createServer(common.mustCall(function(req, res) { | |
| 11 | 11 | res.end('testing ended state', common.mustCall()); | |
| 12 | + assert.strictEqual(res.writableCorked, 0); | ||
| 12 | 13 | res.end(common.mustCall((err) => { | |
| 13 | 14 | assert.strictEqual(err.code, 'ERR_STREAM_ALREADY_FINISHED'); | |
| 14 | 15 | })); | |
| 16 | + assert.strictEqual(res.writableCorked, 0); | ||
| 15 | 17 | res.end('end', onWriteAfterEndError); | |
| 18 | + assert.strictEqual(res.writableCorked, 0); | ||
| 16 | 19 | res.on('error', onWriteAfterEndError); | |
| 17 | 20 | res.on('finish', common.mustCall(() => { | |
| 18 | 21 | res.end(common.mustCall((err) => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments