[libvirt PATCH] ch: use CURLOPT_UPLOAD instead of CURLOPT_PUT

Daniel P. Berrangé posted 1 patch 1 year, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20230118094655.444885-1-berrange@redhat.com
src/ch/ch_monitor.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt PATCH] ch: use CURLOPT_UPLOAD instead of CURLOPT_PUT
Posted by Daniel P. Berrangé 1 year, 3 months ago
The CURLOPT_PUT constant causes a deprecation warning when compiling on
Alpine Edge.  The docs indicate it is deprecated since 7.2.1

  https://curl.se/libcurl/c/CURLOPT_PUT.html

We already use CURLOPT_UPLOAD in the ESX driver, so this brings the CH
driver into line.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 src/ch/ch_monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
index 8d8654332f..7b8f0a8077 100644
--- a/src/ch/ch_monitor.c
+++ b/src/ch/ch_monitor.c
@@ -660,7 +660,7 @@ virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint)
 
     curl_easy_setopt(mon->handle, CURLOPT_UNIX_SOCKET_PATH, mon->socketpath);
     curl_easy_setopt(mon->handle, CURLOPT_URL, url);
-    curl_easy_setopt(mon->handle, CURLOPT_PUT, true);
+    curl_easy_setopt(mon->handle, CURLOPT_UPLOAD, 1L);
     curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, NULL);
 
     responseCode = virCHMonitorCurlPerform(mon->handle);
-- 
2.39.0

Re: [libvirt PATCH] ch: use CURLOPT_UPLOAD instead of CURLOPT_PUT
Posted by Michal Prívozník 1 year, 3 months ago
On 1/18/23 10:46, Daniel P. Berrangé wrote:
> The CURLOPT_PUT constant causes a deprecation warning when compiling on
> Alpine Edge.  The docs indicate it is deprecated since 7.2.1
> 
>   https://curl.se/libcurl/c/CURLOPT_PUT.html
> 
> We already use CURLOPT_UPLOAD in the ESX driver, so this brings the CH
> driver into line.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  src/ch/ch_monitor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal

Re: [libvirt PATCH] ch: use CURLOPT_UPLOAD instead of CURLOPT_PUT
Posted by Daniel P. Berrangé 1 year, 3 months ago
On Wed, Jan 18, 2023 at 09:46:55AM +0000, Daniel P. Berrangé wrote:
> The CURLOPT_PUT constant causes a deprecation warning when compiling on
> Alpine Edge.  The docs indicate it is deprecated since 7.2.1
> 
>   https://curl.se/libcurl/c/CURLOPT_PUT.html

I should also mention here that 7.87 introduced compile time warnings
about deprecated features, which is why we only just see the warning
now.

> 
> We already use CURLOPT_UPLOAD in the ESX driver, so this brings the CH
> driver into line.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  src/ch/ch_monitor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c
> index 8d8654332f..7b8f0a8077 100644
> --- a/src/ch/ch_monitor.c
> +++ b/src/ch/ch_monitor.c
> @@ -660,7 +660,7 @@ virCHMonitorPutNoContent(virCHMonitor *mon, const char *endpoint)
>  
>      curl_easy_setopt(mon->handle, CURLOPT_UNIX_SOCKET_PATH, mon->socketpath);
>      curl_easy_setopt(mon->handle, CURLOPT_URL, url);
> -    curl_easy_setopt(mon->handle, CURLOPT_PUT, true);
> +    curl_easy_setopt(mon->handle, CURLOPT_UPLOAD, 1L);
>      curl_easy_setopt(mon->handle, CURLOPT_HTTPHEADER, NULL);
>  
>      responseCode = virCHMonitorCurlPerform(mon->handle);
> -- 
> 2.39.0
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|