GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — node/test/sequential/test-http2-settings-flood.js at main · Ms2ger/node Expand file tree/ Copy pathtest-http2-settings-flood.jsMore file actions 58 lines (46 loc) · 1.92 KB / Copy pathtest-http2-settings-flood.jsFile metadata and controls58 lines (46 loc) · 1.92 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 'use strict'; const common = require('../common'); if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); const http2 = require('http2'); const net = require('net'); const http2util = require('../common/http2'); // Test that settings flooding causes the session to be torn down const kSettings = new http2util.SettingsFrame(); const server = http2.createServer(); let interval; server.on('stream', common.mustNotCall()); server.on('session', common.mustCall((session) => { session.on('error', common.mustCallAtLeast((e) => { assert.strictEqual(e.code, 'ERR_HTTP2_ERROR'); assert(e.message.includes('Flooding was detected')); clearInterval(interval); }, 0)); session.on('close', common.mustCall(() => { server.close(); })); })); server.listen(0, common.mustCall(() => { const client = net.connect(server.address().port); // nghttp2 uses a limit of 10000 items in it's outbound queue. // If this number is exceeded, a flooding error is raised. // TODO(jasnell): Unfortunately, this test is inherently flaky because // it is entirely dependent on how quickly the server is able to handle // the inbound frames and whether those just happen to overflow nghttp2's // outbound queue. The threshold at which the flood error occurs can vary // from one system to another, and from one test run to another. client.on('connect', common.mustCall(() => { client.write(http2util.kClientMagic, () => { interval = setInterval(() => { for (let n = 0; n < 10000; n++) client.write(kSettings.data); }, 1); }); })); // An error event may or may not be emitted, depending on operating system // and timing. We do not really care if one is emitted here or not, as the // error on the server side is what we are testing for. Do not make this // a common.mustCall() and there's no need to check the error details. client.on('error', () => {}); })); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |