summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-08-26 08:30:38 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-08-26 08:33:10 +0200
commit85d51af9dfacefced45f4f373cf9998b5a965438 (patch)
tree5625491ee8f9a8c5383e1e4f3931e9e48b3b42c7
parent23ee05aca4856045417ec925370909fdc9c5a096 (diff)
downloadcurl-bagder/curl-options-types.tar.gz
configure: added --disable-get-easy-optionsbagder/curl-options-types
To allow disabling of the curl_easy_option APIs in a build.
-rwxr-xr-xconfigure.ac18
-rw-r--r--docs/CURL-DISABLE.md5
-rw-r--r--lib/easygetopt.c22
3 files changed, 45 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 918003e02..99518c165 100755
--- a/configure.ac
+++ b/configure.ac
@@ -4813,6 +4813,24 @@ AC_HELP_STRING([--disable-dnsshuffle],[Disable DNS shuffling]),
)
dnl ************************************************************
+dnl disable the curl_easy_options API
+dnl
+AC_MSG_CHECKING([whether to support curl_easy_option*])
+AC_ARG_ENABLE(get-easy-option,
+AC_HELP_STRING([--enable-get-easy-options],[Enable curl_easy_options])
+AC_HELP_STRING([--disable-get-easy-options],[Disable curl_easy_options]),
+[ case "$enableval" in
+ no)
+ AC_MSG_RESULT(no)
+ AC_DEFINE(CURL_DISABLE_GETOPTIONS, 1, [to disable curl_easy_options])
+ ;;
+ *) AC_MSG_RESULT(yes)
+ ;;
+ esac ],
+ AC_MSG_RESULT(yes)
+)
+
+dnl ************************************************************
dnl switch on/off alt-svc
dnl
curl_altsvc_msg="no (--enable-alt-svc)";
diff --git a/docs/CURL-DISABLE.md b/docs/CURL-DISABLE.md
index 83436b473..1dd72d72c 100644
--- a/docs/CURL-DISABLE.md
+++ b/docs/CURL-DISABLE.md
@@ -24,6 +24,11 @@ Disable the FILE protocol
Disable the FTP (and FTPS) protocol
+## CURL_DISABLE_GETOPTIONS
+
+Disable the `curl_easy_options` API calls that lets users get information
+about existing options to `curl_easy_setopt`.
+
## CURL_DISABLE_GOPHER
Disable the GOPHER protocol.
diff --git a/lib/easygetopt.c b/lib/easygetopt.c
index 8cfd49977..c4c6f631c 100644
--- a/lib/easygetopt.c
+++ b/lib/easygetopt.c
@@ -24,6 +24,8 @@
#include "strcase.h"
#include "easyoptions.h"
+#ifndef CURL_DISABLE_GETOPTIONS
+
/* Lookups easy options at runtime */
static struct curl_easyoption *lookup(const char *name, CURLoption id)
{
@@ -71,3 +73,23 @@ curl_easy_option_next(const struct curl_easyoption *prev)
return NULL;
}
+#else
+const struct curl_easyoption *curl_easy_option_by_name(const char *name)
+{
+ (void)name;
+ return NULL;
+}
+
+const struct curl_easyoption *curl_easy_option_by_id (CURLoption id)
+{
+ (void)id;
+ return NULL;
+}
+
+const struct curl_easyoption *
+curl_easy_option_next(const struct curl_easyoption *prev)
+{
+ (void)prev;
+ return NULL;
+}
+#endif