Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

‘CURLOPT_HTTPPOST’ deprecated #2070

Open
2 of 8 tasks
aerospeace opened this issue Jan 7, 2023 · 4 comments
Open
2 of 8 tasks

‘CURLOPT_HTTPPOST’ deprecated #2070

aerospeace opened this issue Jan 7, 2023 · 4 comments

Comments

@aerospeace
Copy link

IMPORTANT: Before you create an issue, please take a look at our Issue Reporting Guide.

Briefly summarize your issue:

When building the SDK Sample App, the build fails due to the fact that ‘CURLOPT_HTTPPOST’ is deprecated.

What is the expected behavior?

Compilation successful

What behavior are you observing?

Compilation fails with the following:

/home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp:247:26: error: ‘CURLOPT_HTTPPOST’ is deprecated: since 7.56.0. Use CURLOPT_MIMEPOST [-Werror=deprecated-declarations]
  247 |             ret = setopt(CURLOPT_HTTPPOST, m_post);
      |                          ^~~~~~~~~~~~~~~~
In file included from /home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/include/AVSCommon/Utils/LibcurlUtils/CurlEasyHandleWrapper.h:20,
                 from /home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp:20:
/usr/include/curl/curl.h:1195:3: note: declared here
 1195 |   CURLOPTDEPRECATED(CURLOPT_HTTPPOST, CURLOPTTYPE_OBJECTPOINT, 24,
      |   ^~~~~~~~~~~~~~~~~
/home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp: In member function ‘void alexaClientSDK::avsCommon::utils::libcurlUtils::CurlEasyHandleWrapper::cleanupResources()’:
/home/cha/sdk-folder/sdk-source/avs-device-sdk/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp:302:22: error: ‘void curl_formfree(curl_httppost*)’ is deprecated: since 7.56.0. Use curl_mime_free() [-Werror=deprecated-declarations]
  302 |         curl_formfree(m_post);
      |         ~~~~~~~~~~~~~^~~~~~~~
/usr/include/curl/curl.h:2606:1: note: declared here
 2606 | curl_formfree(struct curl_httppost *form);
      | ^~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[3]: *** [AVSCommon/CMakeFiles/AVSCommon.dir/build.make:734: AVSCommon/CMakeFiles/AVSCommon.dir/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:11124: AVSCommon/CMakeFiles/AVSCommon.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:18943: SampleApplications/ConsoleSampleApplication/src/CMakeFiles/SampleApp.dir/rule] Error 2
make: *** [Makefile:5093: SampleApp] Error 2

Provide the steps to reproduce the issue, if applicable:

Follow the exact documentation in https://developer.amazon.com/en-US/docs/alexa/avs-device-sdk/ubuntu.html

Tell us about your environment:

What version of the AVS Device SDK are you using?

3.0

Tell us what hardware you're using:

  • Desktop / Laptop
  • Raspberry Pi
  • Other - tell us more:

Tell us about your OS (Type & version):

  • Linux (Arch)
  • MacOS
  • Raspbian Stretch
  • Raspbian Jessy
  • Other - tell us more:
@kjkh
Copy link

kjkh commented Jan 13, 2023

Hi,

Thank you for reporting this. Can you share which version of curl you are using?

@aerospeace
Copy link
Author

Hi,

Thanks for you response.
I am using curl 7.87.0.

Exact details:
curl 7.87.0 (x86_64-pc-linux-gnu) libcurl/7.87.0 OpenSSL/3.0.7 zlib/1.2.13 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.4 libpsl/0.21.2 (+libidn2/2.3.4) libssh2/1.10.0 nghttp2/1.51.0 Release-Date: 2022-12-21 Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

@tinypancake
Copy link

@aerospeace
you can try with this patch, my curl version is 7.88.1.

diff --git a/AVSCommon/Utils/include/AVSCommon/Utils/LibcurlUtils/CurlEasyHandleWrapper.h b/AVSCommon/Utils/include/AVSCommon/Utils/LibcurlUtils/CurlEasyHandleWrapper.h
index 69976e2..94b60a8 100644
--- a/AVSCommon/Utils/include/AVSCommon/Utils/LibcurlUtils/CurlEasyHandleWrapper.h
+++ b/AVSCommon/Utils/include/AVSCommon/Utils/LibcurlUtils/CurlEasyHandleWrapper.h
@@ -353,9 +353,9 @@ private:
     /// A list of headers needed to be added to a POST action
     curl_slist* m_postHeaders;
     /// The associated multipart post
-    curl_httppost* m_post;
+    curl_mime* m_post;
     /// The last post used in curl_formadd
-    curl_httppost* m_lastPost;
+    curl_mime* m_lastPost;
     /// Name for this handle.
     std::string m_id;
     /// Synchronizes access to the @c m_interfaceName
diff --git a/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp b/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp
index b508f8e..cb2bca2 100644
--- a/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp
+++ b/AVSCommon/Utils/src/LibcurlUtils/CurlEasyHandleWrapper.cpp
@@ -244,7 +244,7 @@ bool CurlEasyHandleWrapper::setTransferType(TransferType type) {
             ret = setopt(CURLOPT_HTTPGET, 1L);
             break;
         case TransferType::kPOST:
-            ret = setopt(CURLOPT_HTTPPOST, m_post);
+            ret = setopt(CURLOPT_MIMEPOST, m_post);
             break;
         case TransferType::kPUT:
             ret = setopt(CURLOPT_UPLOAD, 1L);
@@ -299,7 +299,7 @@ void CurlEasyHandleWrapper::cleanupResources() {
     }
 
     if (m_post) {
-        curl_formfree(m_post);
+        curl_mime_free(m_post);
         m_post = nullptr;
         m_lastPost = nullptr;
     }

@gabm
Copy link

gabm commented May 15, 2023

I had the same problem, tried your patch and it works.. it removes the deprecated calls...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants