| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fc5f126 commit b818924
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -706,7 +706,7 @@ class Http2ServerResponse extends Stream { | |||
| 706 | 706 | writeHead(statusCode, statusMessage, headers) { | |
| 707 | 707 | const state = this[kState]; | |
| 708 | 708 | ||
| 709 | - if (state.closed || this.stream.destroyed) | ||
| 709 | + if (state.closed || this.stream.destroyed || this.stream.closed) | ||
| 710 | 710 | return this; | |
| 711 | 711 | if (this[kStream].headersSent) | |
| 712 | 712 | throw new ERR_HTTP2_HEADERS_SENT(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + if (!common.hasCrypto) { common.skip('missing crypto'); }; | ||
| 5 | + const h2 = require('http2'); | ||
| 6 | + | ||
| 7 | + const server = h2.createServer((req, res) => { | ||
| 8 | + const stream = req.stream; | ||
| 9 | + stream.close(); | ||
| 10 | + res.writeHead(200, { 'content-type': 'text/plain' }); | ||
| 11 | + }); | ||
| 12 | + | ||
| 13 | + server.listen(0, common.mustCall(() => { | ||
| 14 | + const port = server.address().port; | ||
| 15 | + const client = h2.connect(`http://localhost:${port}`); | ||
| 16 | + const req = client.request({ ':path': '/' }); | ||
| 17 | + req.on('response', common.mustNotCall('head after close should not be sent')); | ||
| 18 | + req.on('end', common.mustCall(() => { | ||
| 19 | + client.close(); | ||
| 20 | + server.close(); | ||
| 21 | + })); | ||
| 22 | + req.end(); | ||
| 23 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments