fix compatibility with older libcurl versions default tip

Thu, 12 Dec 2024 16:46:43 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Thu, 12 Dec 2024 16:46:43 +0100
changeset 851
55c5d36b82b7
parent 850
bbe2925eb590

fix compatibility with older libcurl versions

libidav/session.c file | annotate | diff | comparison | revisions
--- a/libidav/session.c	Thu Nov 28 17:53:13 2024 +0100
+++ b/libidav/session.c	Thu Dec 12 16:46:43 2024 +0100
@@ -211,7 +211,21 @@
             char *log_method;
             char *log_url;
             curl_easy_getinfo(sn->handle, CURLINFO_EFFECTIVE_URL, &log_url);
+#if LIBCURL_VERSION_NUM >= 0x074800
             curl_easy_getinfo(sn->handle, CURLINFO_EFFECTIVE_METHOD , &log_method);
+#else
+            long opt_upload = 0;
+            curl_easy_getinfo(sn->handle, CURLOPT_UPLOAD, &opt_upload);
+            char *opt_custom = NULL;
+            curl_easy_getinfo(sn->handle, CURLOPT_CUSTOMREQUEST, &opt_custom);
+            if(opt_custom) {
+                log_method = opt_custom;
+            } else if(opt_upload) {
+                log_method = "PUT";
+            } else {
+                log_method = "GET";
+            }
+#endif
             char *log_reqbody = NULL;
             size_t log_reqbodylen = 0;
             char *log_rpbody = NULL;

mercurial