Hi, We use curl library and a lot of curl_easy_setopt() calls in our application. When our application is run with curl library compiled without some features we can get the following error message from failed curl_easy_setopt() call:
"An unknown option was passed in to libcurl” I understand that this is all that cURL can tell because the option that was passed to it was part of the functionality that wasn’t chosen at a compile time. For example, target library was compiled without support for SMTP protocol. Our application tries to send email using cURL, tries to set CURLOPT_MAIL_FROM and gets an error that this option is unknown. All clear at this point. Now what we would like is to have the identifier “CURLOPT_MAIL_FROM”, that caused the failure, in the error message that we print to the user. I don’t want to specify the option 2 times in every call (pseudo code): if (!curl_easy_setopt(... CURLOPT_MAIL_FROM…) ) { snprintf(error, “setting CURLOPT_MAIL_FROM failed: …”); goto out; } So I tried it with #define but then you deal with static name of the error buffer and the GOTO label (in some parts we use it, but not everythere). So it seems I need a kind of wrapper function that returns an error message together with an option that was attempted to be set. For example: "cannot set CURLOPT_MAIL_FROM: An unknown option was passed in to libcurl" This way we would understand from the error message what exactly is missing from the target library. I see in the source code of the library there is a function Curl_vsetopt(), I thought this is what I could use, but it’s internal. Any idea how I could achieve this? Or maybe there are plans to improve the error message by saying which option (name) it failed to set? TIA! Cheers, VL -- Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library Etiquette: https://curl.se/mail/etiquette.html