Skip to content

Commit

Permalink
test: add ALPNProtocols option to clientOptions
Browse files Browse the repository at this point in the history
Without this, the session is destroyed with the following error

```
Error [ERR_HTTP2_ERROR]: Protocol error
    at Http2Session.onSessionInternalError (internal/http2/core.js:756:26)
Emitted 'error' event on ClientHttp2Session instance at:
    at emitClose (internal/http2/core.js:1010:10)
    at internal/http2/core.js:1048:7
    at finish (internal/streams/writable.js:731:5)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'ERR_HTTP2_ERROR',
  errno: -505
}
```

The test then calls `session.close()` which tries to write to a
destroyed socket. As a result, an unhandled `ECONNRESET` error is
emitted in the v12 release line.

Backport-PR-URL: #34859
PR-URL: #35482
Refs: #34859
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
lpinca authored and MylesBorins committed Nov 16, 2020
1 parent 12d76b8 commit 02787ce
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions test/parallel/test-http2-connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ const { connect: tlsConnect } = require('tls');
};

const clientOptions = {
ALPNProtocols: ['h2'],
port,
rejectUnauthorized: false
};
Expand Down

0 comments on commit 02787ce

Please sign in to comment.