| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ab75548 commit cef9097
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -335,7 +335,7 @@ Immediately terminates the `Http2Session` and the associated `net.Socket` or | |||
| 335 | 335 | `tls.TLSSocket`. | |
| 336 | 336 | ||
| 337 | 337 | Once destroyed, the `Http2Session` will emit the `'close'` event. If `error` | |
| 338 | - is not undefined, an `'error'` event will be emitted immediately after the | ||
| 338 | + is not undefined, an `'error'` event will be emitted immediately before the | ||
| 339 | 339 | `'close'` event. | |
| 340 | 340 | ||
| 341 | 341 | If there are any remaining open `Http2Streams` associated with the | |
@@ -816,9 +816,9 @@ added: v8.4.0 | |||
| 816 | 816 | The `'close'` event is emitted when the `Http2Stream` is destroyed. Once | |
| 817 | 817 | this event is emitted, the `Http2Stream` instance is no longer usable. | |
| 818 | 818 | ||
| 819 | - The listener callback is passed a single argument specifying the HTTP/2 error | ||
| 820 | - code specified when closing the stream. If the code is any value other than | ||
| 821 | - `NGHTTP2_NO_ERROR` (`0`), an `'error'` event will also be emitted. | ||
| 819 | + The HTTP/2 error code used when closing the stream can be retrieved using | ||
| 820 | + the `http2stream.rstCode` property. If the code is any value other than | ||
| 821 | + `NGHTTP2_NO_ERROR` (`0`), an `'error'` event will have also been emitted. | ||
| 822 | 822 | ||
| 823 | 823 | #### Event: 'error' | |
| 824 | 824 | <!-- YAML | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1503,7 +1503,6 @@ class Http2Stream extends Duplex { | |||
| 1503 | 1503 | constructor(session, options) { | |
| 1504 | 1504 | options.allowHalfOpen = true; | |
| 1505 | 1505 | options.decodeStrings = false; | |
| 1506 | - options.emitClose = false; | ||
| 1507 | 1506 | super(options); | |
| 1508 | 1507 | this[async_id_symbol] = -1; | |
| 1509 | 1508 | ||
@@ -1888,9 +1887,7 @@ class Http2Stream extends Duplex { | |||
| 1888 | 1887 | // will destroy if it has been closed and there are no other open or | |
| 1889 | 1888 | // pending streams. | |
| 1890 | 1889 | session[kMaybeDestroy](); | |
| 1891 | - process.nextTick(emit, this, 'close', code); | ||
| 1892 | 1890 | callback(err); | |
| 1893 | - | ||
| 1894 | 1891 | } | |
| 1895 | 1892 | // The Http2Stream can be destroyed if it has closed and if the readable | |
| 1896 | 1893 | // side has received the final chunk. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -49,9 +49,9 @@ server.listen(0, common.mustCall(() => { | |||
| 49 | 49 | // Second call doesn't do anything. | |
| 50 | 50 | req.close(closeCode + 1); | |
| 51 | 51 | ||
| 52 | - req.on('close', common.mustCall((code) => { | ||
| 52 | + req.on('close', common.mustCall(() => { | ||
| 53 | 53 | assert.strictEqual(req.destroyed, true); | |
| 54 | - assert.strictEqual(code, closeCode); | ||
| 54 | + assert.strictEqual(req.rstCode, closeCode); | ||
| 55 | 55 | server.close(); | |
| 56 | 56 | client.close(); | |
| 57 | 57 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,9 +36,9 @@ server.listen(0, common.mustCall(() => { | |||
| 36 | 36 | message: 'test' | |
| 37 | 37 | })); | |
| 38 | 38 | ||
| 39 | - req.on('close', common.mustCall((code) => { | ||
| 39 | + req.on('close', common.mustCall(() => { | ||
| 40 | + assert.strictEqual(req.rstCode, NGHTTP2_INTERNAL_ERROR); | ||
| 40 | 41 | assert.strictEqual(req.rstCode, NGHTTP2_INTERNAL_ERROR); | |
| 41 | - assert.strictEqual(code, NGHTTP2_INTERNAL_ERROR); | ||
| 42 | 42 | server.close(); | |
| 43 | 43 | client.close(); | |
| 44 | 44 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,8 +37,8 @@ server.on('stream', common.mustCall((stream) => { | |||
| 37 | 37 | pushedStream.respond(); | |
| 38 | 38 | pushedStream.on('aborted', common.mustCall()); | |
| 39 | 39 | pushedStream.on('error', common.mustNotCall()); | |
| 40 | - pushedStream.on('close', common.mustCall((code) => { | ||
| 41 | - assert.strictEqual(code, 8); | ||
| 40 | + pushedStream.on('close', common.mustCall(() => { | ||
| 41 | + assert.strictEqual(pushedStream.rstCode, 8); | ||
| 42 | 42 | countdown.dec(); | |
| 43 | 43 | })); | |
| 44 | 44 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,8 +28,8 @@ server.on('listening', common.mustCall(() => { | |||
| 28 | 28 | const client = h2.connect(`http://localhost:${server.address().port}`); | |
| 29 | 29 | const req = client.request(); | |
| 30 | 30 | req.on('headers', common.mustNotCall()); | |
| 31 | - req.on('close', common.mustCall((code) => { | ||
| 32 | - assert.strictEqual(h2.constants.NGHTTP2_NO_ERROR, code); | ||
| 31 | + req.on('close', common.mustCall(() => { | ||
| 32 | + assert.strictEqual(h2.constants.NGHTTP2_NO_ERROR, req.rstCode); | ||
| 33 | 33 | server.close(); | |
| 34 | 34 | client.close(); | |
| 35 | 35 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,8 +50,8 @@ server.listen(0, common.mustCall(() => { | |||
| 50 | 50 | ':method': 'POST', | |
| 51 | 51 | 'rstcode': test[0] | |
| 52 | 52 | }); | |
| 53 | - req.on('close', common.mustCall((code) => { | ||
| 54 | - assert.strictEqual(code, test[0]); | ||
| 53 | + req.on('close', common.mustCall(() => { | ||
| 54 | + assert.strictEqual(req.rstCode, test[0]); | ||
| 55 | 55 | countdown.dec(); | |
| 56 | 56 | })); | |
| 57 | 57 | req.on('aborted', common.mustCall()); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,8 +22,8 @@ server.listen(0, common.mustCall(() => { | |||
| 22 | 22 | type: Error, | |
| 23 | 23 | message: 'Stream closed with error code NGHTTP2_ENHANCE_YOUR_CALM' | |
| 24 | 24 | })); | |
| 25 | - req.on('close', common.mustCall((code) => { | ||
| 26 | - assert.strictEqual(code, NGHTTP2_ENHANCE_YOUR_CALM); | ||
| 25 | + req.on('close', common.mustCall(() => { | ||
| 26 | + assert.strictEqual(req.rstCode, NGHTTP2_ENHANCE_YOUR_CALM); | ||
| 27 | 27 | server.close(); | |
| 28 | 28 | client.close(); | |
| 29 | 29 | })); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,8 +25,8 @@ server.listen(0, common.mustCall(() => { | |||
| 25 | 25 | type: Error, | |
| 26 | 26 | message: 'Stream closed with error code NGHTTP2_ENHANCE_YOUR_CALM' | |
| 27 | 27 | })); | |
| 28 | - req.on('close', common.mustCall((code) => { | ||
| 29 | - assert.strictEqual(code, NGHTTP2_ENHANCE_YOUR_CALM); | ||
| 28 | + req.on('close', common.mustCall(() => { | ||
| 29 | + assert.strictEqual(req.rstCode, NGHTTP2_ENHANCE_YOUR_CALM); | ||
| 30 | 30 | server.close(); | |
| 31 | 31 | client.close(); | |
| 32 | 32 | })); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments