cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: List available curl options

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 11 Dec 2014 09:06:35 +0100

On Wed, Dec 10, 2014 at 10:52:46PM -0800, Jeroen Ooms wrote:
> I'm writing some bindings to libcurl for a scripting language. I was
> wondering if there is an API call or some other method to list the
> options (CURLOPT_* values and their integer) that the linked version
> of libcurl supports?
>
> That would make it easier to test in the client if a particular option
> is available, and pass it to libcurl as the corresponding integer. I'm
> not sure how else to design a client where the user can specify an
> option (as a string), and then have it resolve to the appropriate
> CURLOPT value.
>
> How are other clients doing this?

The curl_easy_setopt call will return CURLE_UNKNOWN_OPTION or
CURLE_NOT_BUILT_IN if the option is not supported. That's the most reliable way
of telling. It's unusual that a program would need to know if an option is
supported without actually trying to use that option.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-12-11