Skip to content

Commit

Permalink
Add extra error handling for some incoming connection cases
Browse files Browse the repository at this point in the history
  • Loading branch information
pimterry committed Jun 3, 2021
1 parent 885a787 commit 38441aa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/server/http-combo-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function ifTlsDropped(socket: tls.TLSSocket, errorCallback: () => void) {
socket.once('data', resolve);

// If you silently close it very quicky, you probably don't trust us
socket.once('error', reject);
socket.once('close', reject);
socket.once('end', reject);

Expand Down
1 change: 1 addition & 0 deletions src/server/mockttp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ export default class MockttpServer extends AbstractMockttp implements Mockttp {
// In Node 16+ we don't get an abort event in many cases, just closes, but we know
// it's aborted because the response is closed with no other result being set.
rawResponse.once('close', () => setImmediate(abort));
request.once('error', () => setImmediate(abort));

this.announceInitialRequestAsync(request);

Expand Down

0 comments on commit 38441aa

Please sign in to comment.