From 8a2e15c88512ae4517d2c2c887d39299725b22da Mon Sep 17 00:00:00 2001
From: Milan Crha <mcrha@redhat.com>
Date: Tue, 13 May 2025 09:52:48 +0200
Subject: [PATCH] soup-body-input-stream: Correct chunked trailers end
detection
The `if` was always `true`, because the `metabuf` cannot be both values
at the same time, thus at least one of the `strncmp` returned non-zero.
Related to https://gitlab.gnome.org/GNOME/libsoup/-/issues/445
Part-of: <https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/458>
Conflict:move libsoup/http1/soup-body-input-stream.c to libsoup/soup-body-input-stream.c
Reference:https://gitlab.gnome.org/GNOME/libsoup/-/commit/8a2e15c88512ae4517d2c2c887d39299725b22da
libsoup/soup-body-input-stream.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -214,7 +214,7 @@ again:
if (nread <= 0)
return nread;
- if (strncmp (metabuf, "\r\n", nread) || strncmp (metabuf, "\n", nread)) {
+ if ((nread == 2 && strncmp (metabuf, "\r\n", nread) == 0) || (nread == 1 && strncmp (metabuf, "\n", nread) == 0)) {
bistream->priv->chunked_state = SOUP_BODY_INPUT_STREAM_STATE_DONE;
bistream->priv->eof = TRUE;
}
--
2.33.0