From 4a12d5db148c24d26549d8cc84a6360733eec253 Mon Sep 17 00:00:00 2001 From: Sebastiano Merlino Date: Wed, 7 Oct 2026 16:25:08 -0700 Subject: [PATCH] ci: annotate libcurl long types in multipart regression --- ChangeLog | 2 ++ test/integ/file_upload.cpp | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7fc37eb4..1d9d4b40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ Version 2.0.1 + Fixed CI lint annotations for libcurl-required long types in the + raw multipart upload regression helper. Fixed an unauthenticated server crash when a multipart file part omits the name attribute. Unnamed file parts are ignored before memory or disk upload handling. Thanks to AllenYen for the private report. diff --git a/test/integ/file_upload.cpp b/test/integ/file_upload.cpp index de647b32..97646f3e 100644 --- a/test/integ/file_upload.cpp +++ b/test/integ/file_upload.cpp @@ -297,7 +297,8 @@ class print_file_upload_resource : public http_resource { // Raw multipart bytes preserve the missing name attribute; curl_mime would // supply a name and conceal this malformed-input regression. -static std::pair send_raw_multipart(int port, const string& body) { +// libcurl requires long for POSTFIELDSIZE and the response-code output. +static std::pair send_raw_multipart(int port, const string& body) { // NOLINT(runtime/int) CURL* curl = curl_easy_init(); const string url = "http://127.0.0.1:" + std::to_string(port) + "/anything"; curl_slist* headers = curl_slist_append(nullptr, @@ -305,12 +306,12 @@ static std::pair send_raw_multipart(int port, const string& body curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.data()); - curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast(body.size())); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast(body.size())); // NOLINT(runtime/int) curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5L); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, +[](char*, size_t size, size_t count, void*) -> size_t { return size * count; }); const CURLcode result = curl_easy_perform(curl); - long status = 0; + long status = 0; // NOLINT(runtime/int) curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status); curl_easy_cleanup(curl); curl_slist_free_all(headers);