cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: List available curl options

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 16 Dec 2014 09:32:53 +0100 (CET)

On Mon, 15 Dec 2014, Jeroen Ooms wrote:

> The goal is to create a list of all available options (name and integer)
> during compile-time, so that the user in the scripting language can name an
> arbitrary option as a string (say "ACCEPT_ENCODING") at run-time.

I assume you'll be fine with only supporting the particular names this release
supports theb? I mean, the symbols-in-versions document for example also
includes names that no longer are in use.

> Then we can use this list to (1) check if this option exists in the current
> version, and (2) use the list to map that the string to the appropriate
> integer that we need to feed to curl_easy_setopt. All at runtime.

To get the full set of strings, you need to extract them from either
inlude/curl/curl.h - which means relying on the CINIT lines to remain there as
they have for the last decade or so, or parsing and converting data from
docs/libcurl/symbols-in-versions which has a guaranteed format and is also
made sure to be accurate and updated by the test suite.

I would probably suggest something like the attached script. Run it in the
docs/libcurl directory and it'll generate a list with all known current
CURLOPT_ options. It also uses the LIBCURL_HAS() macro to make sure the
generated list also is possible to compile with older libcurl installations.

-- 
  / daniel.haxx.se


-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2014-12-16