From 4d787ddf0c6a1230a4738c4c8217a4a5cbacc5f8 Mon Sep 17 00:00:00 2001 From: Steven Janzou Date: Fri, 16 Aug 2024 02:15:49 -0600 Subject: [PATCH] Add CURLOPT_POSTFIELDSIZE to address SAM issue 1830 --- src/easycurl.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/easycurl.cpp b/src/easycurl.cpp index ee1d005a..f23e9927 100644 --- a/src/easycurl.cpp +++ b/src/easycurl.cpp @@ -155,8 +155,15 @@ class wxEasyCurl::DLThread : public wxThread { wxString encoded = uri.BuildURI(); curl_easy_setopt(curl, CURLOPT_URL, (const char *) encoded.c_str()); - if (!m_sc->m_postData.IsEmpty()) - curl_easy_setopt(curl, CURLOPT_POSTFIELDS, (const char *) m_sc->m_postData.c_str()); + if (!m_sc->m_postData.IsEmpty()) { +// SAM issue 1830 + auto len = m_sc->m_postData.length(); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, len); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, (const char*)m_sc->m_postData.c_str()); + // wxURI uriPostdata(m_sc->m_postData); +// wxString encodedPostData = uriPostdata.BuildURI(); +// curl_easy_setopt(curl, CURLOPT_POSTFIELDS, (const char*)encodedPostData.c_str()); + } curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);