diff --git a/src/client.c b/src/client.c index b04d3738..fcaf8c03 100644 --- a/src/client.c +++ b/src/client.c @@ -1019,6 +1019,7 @@ client_slurp_result_t client_body_skip(client_t *client) { char buf[2048]; int ret; + ssize_t got; ICECAST_LOG_DEBUG("Slurping client %p", client); @@ -1038,8 +1039,17 @@ client_slurp_result_t client_body_skip(client_t *client) if (left > sizeof(buf)) left = sizeof(buf); - client_body_read(client, buf, left); + got = client_body_read(client, buf, left); + } else { + got = client_body_read(client, buf, sizeof(buf)); + } + if (got < 1) { + ICECAST_LOG_DEBUG("Slurping client %p ... got no data EOF or needs more data", client); + return CLIENT_SLURP_ERROR; + } + + if (client->request_body_length != -1) { if ((size_t)client->request_body_length == client->request_body_read) { ICECAST_LOG_DEBUG("Slurping client %p ... was a success", client); return CLIENT_SLURP_SUCCESS; @@ -1047,8 +1057,6 @@ client_slurp_result_t client_body_skip(client_t *client) ICECAST_LOG_DEBUG("Slurping client %p ... needs more data", client); return CLIENT_SLURP_NEEDS_MORE_DATA; } - } else { - client_body_read(client, buf, sizeof(buf)); } ret = client_body_eof(client); diff --git a/src/connection.c b/src/connection.c index 811f1c75..5262df7d 100644 --- a/src/connection.c +++ b/src/connection.c @@ -737,6 +737,8 @@ static client_slurp_result_t process_request_body_queue_one(client_queue_entry_t client_t *client = node->client; client_slurp_result_t res; + node->ready = false; + if (client->parser->req_type == httpp_req_post) { if (node->bodybuffer == NULL && client->request_body_read == 0) { if (client->request_body_length < 0) {