From ba5e2b2c24d2afd352638555bc8d17733bd96a9e Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Wed, 23 Oct 2024 02:54:33 +0000 Subject: [PATCH] Fix: Corrected handling of TLS body errors and timeouts --- src/connection.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/connection.c b/src/connection.c index 775e0ac1..564bb8f0 100644 --- a/src/connection.c +++ b/src/connection.c @@ -767,7 +767,7 @@ static client_slurp_result_t process_request_body_queue_one(client_queue_entry_t } if (res != CLIENT_SLURP_SUCCESS) { - if (client->con->con_time <= timeout || client->request_body_read >= body_size_limit || client->con->error) { + if (client->con->con_time <= (time(NULL) - timeout) || client->request_body_read >= body_size_limit || client->con->error) { return CLIENT_SLURP_ERROR; } } @@ -1177,10 +1177,17 @@ static void * _handle_connection(client_queue_t *queue) client_queue_add(&_body_queue, node); continue; } else { - ICECAST_LOG_DEBUG("Success on fast lane"); + ICECAST_LOG_DEBUG("Success on fast lane (client=%p)", client); } } + if (client->request_body_length != -1 && (size_t)client->request_body_length != client->request_body_read) { + ICECAST_LOG_DEBUG("Incomplete request, dropping client (client=%p)", client); + free_client_node(node); + client_destroy(client); + continue; + } + rawuri = httpp_getvar(parser, HTTPP_VAR_URI); /* assign a port-based shoutcast mountpoint if required */