[Libguestfs] [PATCH nbdkit 3/6] curl: Fix declarations of globals in "curldefs.h"

Richard W.M. Jones rjones at redhat.com
Sat Feb 4 12:34:55 UTC 2023


Tidy up previous work on this plugin so that every global is declared
in "curldefs.h".  Move the HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
macro to this header file too.
---
 plugins/curl/curldefs.h | 16 ++++++++++++++++
 plugins/curl/curl.c     | 11 +----------
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/plugins/curl/curldefs.h b/plugins/curl/curldefs.h
index fc377d1d3..36f5fd5bb 100644
--- a/plugins/curl/curldefs.h
+++ b/plugins/curl/curldefs.h
@@ -33,8 +33,19 @@
 #ifndef NBDKIT_CURLDEFS_H
 #define NBDKIT_CURLDEFS_H
 
+#include <stdbool.h>
+
 #include "windows-compat.h"
 
+/* Macro CURL_AT_LEAST_VERSION was added in 2015 (Curl 7.43) so if the
+ * macro isn't present then Curl is very old.
+ */
+#ifdef CURL_AT_LEAST_VERSION
+#if CURL_AT_LEAST_VERSION(7, 55, 0)
+#define HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
+#endif
+#endif
+
 extern const char *url;
 
 extern const char *cainfo;
@@ -58,6 +69,9 @@ extern const char *proxy;
 extern char *proxy_password;
 extern const char *proxy_user;
 extern bool sslverify;
+extern const char *ssl_cipher_list;
+extern const char *ssl_version;
+extern const char *tls13_ciphers;
 extern bool tcp_keepalive;
 extern bool tcp_nodelay;
 extern uint32_t timeout;
@@ -65,6 +79,8 @@ extern const char *unix_socket_path;
 extern const char *user;
 extern const char *user_agent;
 
+extern int curl_debug_verbose;
+
 /* The per-connection handle. */
 struct handle {
   int readonly;
diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c
index 2c2620bfe..86d953432 100644
--- a/plugins/curl/curl.c
+++ b/plugins/curl/curl.c
@@ -54,15 +54,6 @@
 
 #include "curldefs.h"
 
-/* Macro CURL_AT_LEAST_VERSION was added in 2015 (Curl 7.43) so if the
- * macro isn't present then Curl is very old.
- */
-#ifdef CURL_AT_LEAST_VERSION
-#if CURL_AT_LEAST_VERSION(7, 55, 0)
-#define HAVE_CURLINFO_CONTENT_LENGTH_DOWNLOAD_T
-#endif
-#endif
-
 /* Plugin configuration. */
 const char *url = NULL;         /* required */
 
@@ -87,8 +78,8 @@ const char *proxy = NULL;
 char *proxy_password = NULL;
 const char *proxy_user = NULL;
 bool sslverify = true;
-const char *ssl_version = NULL;
 const char *ssl_cipher_list = NULL;
+const char *ssl_version = NULL;
 const char *tls13_ciphers = NULL;
 bool tcp_keepalive = false;
 bool tcp_nodelay = true;
-- 
2.39.0



More information about the Libguestfs mailing list