aboutsummaryrefslogtreecommitdiff
path: root/src/tool_paramhlp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tool_paramhlp.c')
-rw-r--r--src/tool_paramhlp.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index d4b96e76d..28872e678 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -339,6 +339,27 @@ long proto2num(struct OperationConfig *config, long *val, const char *str)
}
/**
+ * Check if the given string is a protocol supported by libcurl
+ *
+ * @param str the protocol name
+ * @return PARAM_OK protocol supported
+ * @return PARAM_LIBCURL_UNSUPPORTED_PROTOCOL protocol not supported
+ * @return PARAM_REQUIRES_PARAMETER missing parameter
+ */
+int check_protocol(const char *str)
+{
+ const char * const *pp;
+ const curl_version_info_data *curlinfo = curl_version_info(CURLVERSION_NOW);
+ if(!str)
+ return PARAM_REQUIRES_PARAMETER;
+ for(pp = curlinfo->protocols; *pp; pp++) {
+ if(curlx_raw_equal(*pp, str))
+ return PARAM_OK;
+ }
+ return PARAM_LIBCURL_UNSUPPORTED_PROTOCOL;
+}
+
+/**
* Parses the given string looking for an offset (which may be a
* larger-than-integer value). The offset CANNOT be negative!
*