| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ef4026f commit 5009021
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1444,9 +1444,9 @@ class Http2Session extends EventEmitter { | |||
| 1444 | 1444 | } | |
| 1445 | 1445 | if (payload) { | |
| 1446 | 1446 | validateBuffer(payload, 'payload'); | |
| 1447 | - } | ||
| 1448 | - if (payload && payload.length !== 8) { | ||
| 1449 | - throw new ERR_HTTP2_PING_LENGTH(); | ||
| 1447 | + if (payload.byteLength !== 8) { | ||
| 1448 | + throw new ERR_HTTP2_PING_LENGTH(); | ||
| 1449 | + } | ||
| 1450 | 1450 | } | |
| 1451 | 1451 | validateFunction(callback, 'callback'); | |
| 1452 | 1452 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -64,11 +64,11 @@ server.listen(0, common.mustCall(() => { | |||
| 64 | 64 | }))); | |
| 65 | 65 | } | |
| 66 | 66 | { | |
| 67 | - const payload = Buffer.from('abcdefgi'); | ||
| 67 | + const payload = new Uint16Array([1, 2, 3, 4]); | ||
| 68 | 68 | assert(client.ping(payload, common.mustCall((err, duration, ret) => { | |
| 69 | 69 | assert.strictEqual(err, null); | |
| 70 | 70 | assert.strictEqual(typeof duration, 'number'); | |
| 71 | - assert.deepStrictEqual(payload, ret); | ||
| 71 | + assert.deepStrictEqual(payload.buffer, ret.buffer); | ||
| 72 | 72 | }))); | |
| 73 | 73 | } | |
| 74 | 74 | ||
@@ -99,7 +99,8 @@ server.listen(0, common.mustCall(() => { | |||
| 99 | 99 | { | |
| 100 | 100 | const shortPayload = Buffer.from('abcdefg'); | |
| 101 | 101 | const longPayload = Buffer.from('abcdefghi'); | |
| 102 | - [shortPayload, longPayload].forEach((payloadWithInvalidLength) => | ||
| 102 | + const mismatchedPayload = new Uint32Array(8); | ||
| 103 | + [shortPayload, longPayload, mismatchedPayload].forEach((payloadWithInvalidLength) => | ||
| 103 | 104 | assert.throws( | |
| 104 | 105 | () => client.ping(payloadWithInvalidLength), | |
| 105 | 106 | { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments