1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Fix: Fixed clients in body queue running in undetected EOFs

Thanks to Jordan Erickson
This commit is contained in:
Philipp Schafft 2023-07-26 03:47:55 +00:00
parent 43a8c04134
commit 5a5a1ceb9a
2 changed files with 13 additions and 3 deletions

View File

@ -1019,6 +1019,7 @@ client_slurp_result_t client_body_skip(client_t *client)
{ {
char buf[2048]; char buf[2048];
int ret; int ret;
ssize_t got;
ICECAST_LOG_DEBUG("Slurping client %p", client); 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)) if (left > sizeof(buf))
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) { if ((size_t)client->request_body_length == client->request_body_read) {
ICECAST_LOG_DEBUG("Slurping client %p ... was a success", client); ICECAST_LOG_DEBUG("Slurping client %p ... was a success", client);
return CLIENT_SLURP_SUCCESS; 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); ICECAST_LOG_DEBUG("Slurping client %p ... needs more data", client);
return CLIENT_SLURP_NEEDS_MORE_DATA; return CLIENT_SLURP_NEEDS_MORE_DATA;
} }
} else {
client_body_read(client, buf, sizeof(buf));
} }
ret = client_body_eof(client); ret = client_body_eof(client);

View File

@ -737,6 +737,8 @@ static client_slurp_result_t process_request_body_queue_one(client_queue_entry_t
client_t *client = node->client; client_t *client = node->client;
client_slurp_result_t res; client_slurp_result_t res;
node->ready = false;
if (client->parser->req_type == httpp_req_post) { if (client->parser->req_type == httpp_req_post) {
if (node->bodybuffer == NULL && client->request_body_read == 0) { if (node->bodybuffer == NULL && client->request_body_read == 0) {
if (client->request_body_length < 0) { if (client->request_body_length < 0) {