Hi all again,
I've managed to reproduce my issue with a minimal C sample linking libcurl
8.16.0:
```
#include <curl/curl.h>
int main(int argc, char *argv[])
{
CURLcode ret;
CURL *hnd;
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(hnd, CURLOPT_URL, "https://google.com/");
curl_easy_setopt(hnd, CURLOPT_SSL_VERIFYHOST, 2L);
ret = curl_easy_perform(hnd);
curl_easy_cleanup(hnd);
hnd = NULL;
return (int)ret;
}
```
When run, this produces the following verbose log;
* boolean setopt(81) got unsupported argument 2, treated as 1
* Host google.com:443 was resolved.
* IPv6: 2a00:1450:4007:80e::200e
The erroneous log is `* boolean setopt(81) got unsupported argument 2, treated
as 1`, and I think it has been introduced when refactoring setopt_long to
better deal with boolean option https://github.com/curl/curl/pull/17887/files
On 14/09/2025, 14:12, "curl-library on behalf of Jicea via curl-library"
<[email protected] <mailto:[email protected]>
on behalf of [email protected] <mailto:[email protected]>>
wrote:
--------------------------------------------------------------------------------------------------------------
CAUTION : This email originated outside the company. Do not click on any links
or open attachments unless you are expecting them from the sender.
ATTENTION : Cet e-mail provient de l'extérieur de l'entreprise. Ne cliquez pas
sur les liens ou n'ouvrez pas les pièces jointes à moins de connaitre
l'expéditeur.
--------------------------------------------------------------------------------------------------------------
Hello all,
I'm maintaining a Rust cli that uses libcurl for HTTP exchanges. I'm trying to
understand why I see a libcurl log in my Rust sample
`* boolean setopt(81) got unsupported argument 2, treated as 1`
(81 => CURLOPT_SSL_VERIFYHOST) in some basic samples appearing with libcurl
8.16.0 (I'm testing it on Archlinux)
I'm reaching this channel, because, in my investigation, I've found that there
are some relatively recent changes in curl regarding `setopt_long`/
`setopt_bool` (see <https://github.com/curl/curl/pull/17887>
<https://github.com/curl/curl/pull/17887;>). The cullprit is certainly in Rust
wrapping code around C libcurl but I want to get some advices from libcurl
expert.
The Rust code that trigges this warning is:
```
fn fetch_url(url: &str) {
unsafe {
curl_sys::curl_global_init(curl_sys::CURL_GLOBAL_ALL);
let handle = curl_sys::curl_easy_init();
let url = CString::new(url).unwrap();
let ret = curl_sys::curl_easy_setopt(handle, curl_sys::CURLOPT_URL,
url.as_ptr());
ok_or_exit(ret);
let ret = curl_sys::curl_easy_setopt(handle, curl_sys::CURLOPT_VERBOSE, 1);
ok_or_exit(ret);
let ret = curl_sys::curl_easy_setopt(handle, curl_sys::CURLOPT_SSL_VERIFYHOST,
2);
ok_or_exit(ret);
let ret = curl_sys::curl_easy_perform(handle);
ok_or_exit(ret);
}
}
```
The Rust function `curl_sys::curl_easy_setopt` is defined as (still Rust code
sorry!):
```
extern "C" {
...
pub fn curl_easy_setopt(curl: *mut CURL, option: CURLoption, ...) -> CURLcode;
```
This seems to me (certainly wrongly) a direct call to the C libcurl function
`CURL_EXTERN CURLcode curl_easy_setopt(CURL *curl, CURLoption option, ...)`
So, when the Rust call is
```
let ret = curl_sys::curl_easy_setopt(handle, curl_sys::CURLOPT_SSL_VERIFYHOST,
2);
```
It should call the corresponding libcurl function `CURLcode curl_easy_setopt`,
then `Curl_vsetopt` and finally `setopt_long`.
All this code seems OK to me, I don't see any "weird" logic in Rust warpping
around libcurl and yet, at runtime, with libcurl 8.16.0 I see this log:
`* boolean setopt(81) got unsupported argument 2, treated as 1` in some basic
sample with libcurl 8.16.0.`
As if the path code call triggers a `setopt_bool`.
I'm sorry to ask for advices for this problem (for a Rust cli and certainlty
not a libcurl issue) but I'm a litle stuck in trying to understand this issue.
Thanks for any thought!
Jicea
Orange Restricted
____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations
confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce
message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages
electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou
falsifie. Merci.
This message and its attachments may contain confidential or privileged
information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete
this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been
modified, changed or falsified.
Thank you.
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
<https://lists.haxx.se/mailman/listinfo/curl-library>
Etiquette: https://curl.se/mail/etiquette.html
<https://curl.se/mail/etiquette.html>
____________________________________________________________________________________________________________
Ce message et ses pieces jointes peuvent contenir des informations
confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce
message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages
electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou
falsifie. Merci.
This message and its attachments may contain confidential or privileged
information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete
this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been
modified, changed or falsified.
Thank you.
--
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html