Skip to content

Commit

Permalink
Fix compatibility with Node.js 14
Browse files Browse the repository at this point in the history
If the socket is writable, a write is attempted and an
`ERR_SOCKET_CLOSED` error is emitted because the socket was never
connected.

Refs: nodejs/node#32272
  • Loading branch information
lpinca committed May 16, 2020
1 parent 3d2981c commit 450237e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [6.x, 8.x, 10.x, 12.x]
node-version: [6.x, 8.x, 10.x, 12.x, 14.x]

runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion src/agent.ts
Expand Up @@ -162,7 +162,7 @@ export default class HttpsProxyAgent extends Agent {
// See: https://hackerone.com/reports/541502
socket.destroy();

const fakeSocket = new net.Socket();
const fakeSocket = new net.Socket({ writable: false });
fakeSocket.readable = true;

// Need to wait for the "socket" event to re-play the "data" events.
Expand Down

0 comments on commit 450237e

Please sign in to comment.