curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Adding a new --option to the tool

From: Florents Tselai via curl-library <>
Date: Mon, 28 Aug 2023 20:42:00 +0300

> On 28 Aug 2023, at 8:24 PM, Daniel Stenberg <> wrote:
> On Mon, 28 Aug 2023, Florents Tselai via curl-library wrote:
>> For reference you could check the last commit here
> You have not added code in src/tool_getparam.c:getparameter() that actually does something when the option is provided. I'm guessing you want it something like the patch below.
> You should probably pause and reconsider if this is code for the library or maybe in the tool only.

Correct me if I’m wrong but I’d need both, no ?
There should be some logic that extracts pieces of info from requests and response; in which case I’d have a couple of warc.[c,h] files in the lib which will be called by the tool.

Then again, it would also be an option to keep only two files tool_warc.c and tool_warc.h in the tool directory.
Which means not tweaking the curl.h header at all and hence not making it available through curl.h
Which is probably more orthogonal; I don’t imagine curl exposing a warc API anyhow.

> --- a/src/tool_getparam.c
> +++ b/src/tool_getparam.c
> _at__at_ -1540,10 +1540,13 _at__at_ ParameterError getparameter(const char *flag, /* f or -long-flag */
> case ':':
> switch(subletter) {
> case 'a': /* --variable */
> err = setvariable(global, nextarg);
> break;
> + case 'b': /* --warc-file */
> + GetStr(&config->warc_file, nextarg);
> + break;
> default: /* --next */
> break;
> }
> break;

I had added this in another attempt, tried it now as well, and I now get a similar error,
curl: (48) An unknown option was passed in to libcurl

But at least the flag is now being recognised. That’s a step forward. I’ll dig into it.

> --
> /
> | Commercial curl support up to 24x7 is available!
> | Private help, bug fixes, support, ports, new features
> |

Received on 2023-08-28