Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the cURL-based request engine to avoid libcurl 7.56+ deprecation warnings by switching multipart uploads from the legacy curl_formadd / CURLOPT_HTTPPOST API to the newer MIME API, while retaining a compile-time fallback for older libcurl versions.
Changes:
- Use
curl_mime_*+CURLOPT_MIMEPOSTfor multipart form uploads whenLIBCURL_VERSION_NUM >= 0x073800(7.56.0). - Keep the legacy
curl_formadd/CURLOPT_HTTPPOSTimplementation for older libcurl. - Free the MIME handle after the request completes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
oauth.c:1135
postvalis allocated withestrdup()and then the pointer is advanced with++postval, but the duplicated buffer is never freed. This leaks memory per multipart field (and also loses the base pointer needed forefree). Keep a separate variable for the allocated buffer andefree()it after the MIME part has been configured (libcurl copies the strings).
/* swiped from ext/curl/interface.c to help with consistency */
postval = estrdup(soo->multipart_files[i]);
if (postval[0] == '@' && soo->multipart_params[i][0] == '@') {
/* :< (chomp) @ */
++soo->multipart_params[i];
++postval;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
oauth.c:1136
- In the MIME file upload branch, the code increments
soo->multipart_params[i](to skip the leading '@') which mutates the stored pointer in thesooobject. Even though it is later freed/reset in oauth_fetch, mutating request state in-place is fragile and makes this function harder to reason about. Prefer using a local pointer (e.g.,const char *name = soo->multipart_params[i] + 1) and leaving the stored array untouched.
if (postval[0] == '@' && soo->multipart_params[i][0] == '@') {
/* :< (chomp) @ */
++soo->multipart_params[i];
++postval;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
curl_formadd()/CURLFORM_*/CURLOPT_HTTPPOSTwith the MIME API (curl_mime_init(),curl_mime_addpart(),curl_mime_name(),curl_mime_data(),curl_mime_filedata(),curl_mime_type(),curl_mime_filename(),CURLOPT_MIMEPOST) for multipart form uploads#if LIBCURL_VERSION_NUM >= 0x073800(7.56.0) with fallback to the old API for older libcurlFixes #37