Skip to content

Commit

Permalink
fix: ReverseConnection waits for incoming data before piping data back
Browse files Browse the repository at this point in the history
There was an issue in obscure conditions that caused certain packets to be out of the expected order for HTTP2 leading to a protocol error. This ensure that the `MAGIC` frame comes before the server's `SETTING` frame.

#369
  • Loading branch information
tegefaulkes committed Apr 6, 2022
1 parent edb2477 commit bcac12d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/network/ConnectionReverse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,9 @@ class ConnectionReverse extends Connection {
await this.stop();
});
this.tlsSocket.pipe(this.serverSocket, { end: false });
this.serverSocket.pipe(this.tlsSocket, { end: false });
this.tlsSocket.once('data', () => {
this.serverSocket.pipe(this.tlsSocket as TLSSocket, { end: false });
});
this.clientCertChain = clientCertChain;
this.logger.info('Composed Connection Reverse');
} catch (e) {
Expand Down

0 comments on commit bcac12d

Please sign in to comment.