Skip to content

Commit 4a12d5d

Browse files
committed
ci: annotate libcurl long types in multipart regression
1 parent ae84459 commit 4a12d5d

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎ChangeLog‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Version 2.0.1
22

3+
Fixed CI lint annotations for libcurl-required long types in the
4+
raw multipart upload regression helper.
35
Fixed an unauthenticated server crash when a multipart file part omits
46
the name attribute. Unnamed file parts are ignored before memory
57
or disk upload handling. Thanks to AllenYen for the private report.

‎test/integ/file_upload.cpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,20 +297,21 @@ class print_file_upload_resource : public http_resource {
297297

298298
// Raw multipart bytes preserve the missing name attribute; curl_mime would
299299
// supply a name and conceal this malformed-input regression.
300-
static std::pair<CURLcode, long> send_raw_multipart(int port, const string& body) {
300+
// libcurl requires long for POSTFIELDSIZE and the response-code output.
301+
static std::pair<CURLcode, long> send_raw_multipart(int port, const string& body) { // NOLINT(runtime/int)
301302
CURL* curl = curl_easy_init();
302303
const string url = "http://127.0.0.1:" + std::to_string(port) + "/anything";
303304
curl_slist* headers = curl_slist_append(nullptr,
304305
"Content-Type: multipart/form-data; boundary=BOUNDARY");
305306
curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
306307
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
307308
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, body.data());
308-
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size()));
309+
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, static_cast<long>(body.size())); // NOLINT(runtime/int)
309310
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5L);
310311
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
311312
+[](char*, size_t size, size_t count, void*) -> size_t { return size * count; });
312313
const CURLcode result = curl_easy_perform(curl);
313-
long status = 0;
314+
long status = 0; // NOLINT(runtime/int)
314315
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
315316
curl_easy_cleanup(curl);
316317
curl_slist_free_all(headers);

0 commit comments

Comments
 (0)