summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2025-05-08 12:41:21 -0400
committerAndrew Opalach <andrew@akon.city> 2025-05-08 12:41:21 -0400
commitef86574ec5d859727695da65f683f0774a3b4460 (patch)
treee0736a2f57fd3ed18286e148dad91a340736ff61 /src
parent23ec05f871f53b724dc6eb5e1c62d0245109c69d (diff)
downloadlibnaunet-ef86574ec5d859727695da65f683f0774a3b4460.tar.gz
libnaunet-ef86574ec5d859727695da65f683f0774a3b4460.tar.bz2
libnaunet-ef86574ec5d859727695da65f683f0774a3b4460.zip
Ignore Content-Length on non-200 status code
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src')
-rw-r--r--src/curl/http.c2
-rw-r--r--src/util/file/file_linux.c2
-rw-r--r--src/util/file/file_stdio.c2
3 files changed, 3 insertions, 3 deletions
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 <al/log.h>
#include <sys/mman.h>
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 <al/log.h>
#include <al/lib.h>