From ef86574ec5d859727695da65f683f0774a3b4460 Mon Sep 17 00:00:00 2001 From: Andrew Opalach Date: Thu, 8 May 2025 12:41:21 -0400 Subject: Ignore Content-Length on non-200 status code Signed-off-by: Andrew Opalach --- src/curl/http.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/curl') diff --git a/src/curl/http.c b/src/curl/http.c index 154e0c7..cfb8a18 100644 --- a/src/curl/http.c +++ b/src/curl/http.c @@ -12,7 +12,7 @@ static void check_status_codes(struct nn_curl *curl) http->callback(http->userdata, NNWT_HTTP_RESPONSE_CODE, NULL, &http->status_code); } } - if (http->content_length < 0) { + if (http->content_length < 0 && http->status_code / 100 == 2) { curl_easy_getinfo(curl->handle, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &http->content_length); if (http->content_length >= 0) { http->callback(http->userdata, NNWT_HTTP_CONTENT_LENGTH, NULL, &http->content_length); -- cgit v1.2.3-101-g0448