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 --- meson.build | 4 +++- src/curl/http.c | 2 +- src/util/file/file_linux.c | 2 +- src/util/file/file_stdio.c | 2 +- subprojects/libalabaster.wrap | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/meson.build b/meson.build index 94ae0c0..74d106d 100644 --- a/meson.build +++ b/meson.build @@ -1,5 +1,7 @@ project('libnaunet', 'c', version: '0.01', - default_options: ['warning_level=2', 'c_std=c99']) + meson_version: '>=0.63.0', + default_options: ['warning_level=2', 'c_std=c99'], + license: 'GPL-3.0-only') compiler = meson.get_compiler('c') cmake = import('cmake') 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); diff --git a/src/util/file/file_linux.c b/src/util/file/file_linux.c index 9693d4b..6537d26 100644 --- a/src/util/file/file_linux.c +++ b/src/util/file/file_linux.c @@ -1,4 +1,4 @@ -#define AL_LOG_SECTION "file_linux" +#define AL_LOG_SECTION "file" #include #include diff --git a/src/util/file/file_stdio.c b/src/util/file/file_stdio.c index 48dd545..ae07908 100644 --- a/src/util/file/file_stdio.c +++ b/src/util/file/file_stdio.c @@ -1,4 +1,4 @@ -#define AL_LOG_SECTION "file_stdio" +#define AL_LOG_SECTION "file" #include #include diff --git a/subprojects/libalabaster.wrap b/subprojects/libalabaster.wrap index fe96079..6ab8612 100644 --- a/subprojects/libalabaster.wrap +++ b/subprojects/libalabaster.wrap @@ -1,4 +1,4 @@ [wrap-git] url = https://git.akon.city/libalabaster -revision = a5516233d66eb1552cf7fdfe03779b2bf896c82d +revision = 34a5e136b6c79092eee73857bbad25892fe8047a depth = 1 -- cgit v1.2.3-101-g0448