reset wrong SSL connections instead of close

since we can't properly handle SSL beyond firts packet it does not make much sense to linger it
with proper fin/ack timewait process. A TCP RST would recycle memory much faster.
This commit is contained in:
Emil Muratov
2024-12-19 13:20:08 +09:00
parent c2147e9b8e
commit a2c3152ca7

View File

@@ -71,10 +71,10 @@ void AsyncWebServerRequest::_onData(void* buf, size_t len) {
#ifndef ASYNC_TCP_SSL_ENABLED #ifndef ASYNC_TCP_SSL_ENABLED
if (_parseState == PARSE_REQ_START && len && ((uint8_t*)buf)[0] == 0x16) { // 0x16 indicates a Handshake message (SSL/TLS). if (_parseState == PARSE_REQ_START && len && ((uint8_t*)buf)[0] == 0x16) { // 0x16 indicates a Handshake message (SSL/TLS).
#ifdef ESP32 #ifdef ESP32
log_d("SSL/TLS handshake detected: closing connection"); log_d("SSL/TLS handshake detected: resetting connection");
#endif #endif
_parseState = PARSE_REQ_FAIL; _parseState = PARSE_REQ_FAIL;
_client->close(); _client->abort();
return; return;
} }
#endif #endif