fix(connectionhandler): Ensure proper termination of TLS connections without SNI by explicitly ending the socket after sending the unrecognized_name alert. This prevents the connection from hanging and avoids potential duplicate handling.
This commit is contained in:
		| @@ -1,5 +1,11 @@ | |||||||
| # Changelog | # Changelog | ||||||
|  |  | ||||||
|  | ## 2025-03-18 - 4.2.2 - fix(connectionhandler) | ||||||
|  | Ensure proper termination of TLS connections without SNI by explicitly ending the socket after sending the unrecognized_name alert. This prevents the connection from hanging and avoids potential duplicate handling. | ||||||
|  |  | ||||||
|  | - Added socket.end() after uncorking the alert packet in ClientHello handling to force connection closure. | ||||||
|  | - Prevents duplicate data events and ensures the warning alert is processed by clients like Chrome. | ||||||
|  |  | ||||||
| ## 2025-03-17 - 4.2.1 - fix(core) | ## 2025-03-17 - 4.2.1 - fix(core) | ||||||
| No uncommitted changes detected in the project. | No uncommitted changes detected in the project. | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,6 +3,6 @@ | |||||||
|  */ |  */ | ||||||
| export const commitinfo = { | export const commitinfo = { | ||||||
|   name: '@push.rocks/smartproxy', |   name: '@push.rocks/smartproxy', | ||||||
|   version: '4.2.1', |   version: '4.2.2', | ||||||
|   description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.' |   description: 'A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.' | ||||||
| } | } | ||||||
|   | |||||||
| @@ -589,6 +589,7 @@ export class ConnectionHandler { | |||||||
|               socket.cork(); |               socket.cork(); | ||||||
|               const writeSuccessful = socket.write(serverNameUnknownAlertData); |               const writeSuccessful = socket.write(serverNameUnknownAlertData); | ||||||
|               socket.uncork(); |               socket.uncork(); | ||||||
|  |               socket.end(); | ||||||
|                |                | ||||||
|               // Function to handle the clean socket termination - but more gradually |               // Function to handle the clean socket termination - but more gradually | ||||||
|               const finishConnection = () => { |               const finishConnection = () => { | ||||||
| @@ -597,7 +598,6 @@ export class ConnectionHandler { | |||||||
|  |  | ||||||
|                 // Log the cleanup but wait for natural closure |                 // Log the cleanup but wait for natural closure | ||||||
|                 setTimeout(() => { |                 setTimeout(() => { | ||||||
|                   socket.end(); |  | ||||||
|                   this.connectionManager.cleanupConnection(record, 'session_ticket_blocked_no_sni'); |                   this.connectionManager.cleanupConnection(record, 'session_ticket_blocked_no_sni'); | ||||||
|                 }, 1000); // Longer delay to let socket cleanup happen naturally |                 }, 1000); // Longer delay to let socket cleanup happen naturally | ||||||
|               }; |               }; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user