I would like to get the TLS certificate chain using curl_easy_getinfo(CURL *, CURLINFO_CERTINFO, ...). I initially did this by passing a struct curl_certinfo *, eg:
struct curl_certinfo *certinfo;
curl_easy_getinfo(curl_handle, CURLINFO_CERTINFO, &certinfo);
I did this based on the guidance in the documentation for CURLINFO_CERTINFO:
Pass a pointer to a 'struct curl_certinfo *' and you'll get it set to point to struct that holds a number of linked lists with info about the certificate chain
And indeed this seems to work nicely, however when compiling with GCC, I get the following warning:
warning: call to ‘_curl_easy_getinfo_err_curl_slist’ declared with attribute warning: curl_easy_getinfo expects a pointer to struct curl_slist * for this info
Since there is some handy type checking on that function. This type checking disagrees with the aforementioned documentation, but agrees with the documentation for curl_easy_getinfo.
In addition, the certinfo.c example throws them both into a union and uses them both.
I realize that since you're really getting a pointer to a struct curl_certinfo, and that has a struct curl_slist * as its first member that you can fundamentally use either. But it would be nice if the documentation and examples were internally consistent. Ideally either:
- The documentation for
curl_easy_getinfo was updated to reflect that struct curl_certinfo was a legitimate type and that the header was also updated to reflect this, or
- The documentation for
CURLINFO_CERTINFO was updated to document that struct curl_slist * is the used type.
And that the aforementioned example was updated to only make reference to whichever type is canonical.
I would like to get the TLS certificate chain using
curl_easy_getinfo(CURL *, CURLINFO_CERTINFO, ...). I initially did this by passing astruct curl_certinfo *, eg:I did this based on the guidance in the documentation for
CURLINFO_CERTINFO:And indeed this seems to work nicely, however when compiling with GCC, I get the following warning:
Since there is some handy type checking on that function. This type checking disagrees with the aforementioned documentation, but agrees with the documentation for
curl_easy_getinfo.In addition, the
certinfo.cexample throws them both into a union and uses them both.I realize that since you're really getting a pointer to a
struct curl_certinfo, and that has astruct curl_slist *as its first member that you can fundamentally use either. But it would be nice if the documentation and examples were internally consistent. Ideally either:curl_easy_getinfowas updated to reflect thatstruct curl_certinfowas a legitimate type and that the header was also updated to reflect this, orCURLINFO_CERTINFOwas updated to document thatstruct curl_slist *is the used type.And that the aforementioned example was updated to only make reference to whichever type is canonical.