Description
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 thatstruct 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 thatstruct curl_slist *
is the used type.
And that the aforementioned example was updated to only make reference to whichever type is canonical.
Activity
bagder commentedon Jun 1, 2016
Agreed. It takes a
struct curl_certinfo *
argument and we should make sure bothtypecheck-gcc.h
and thecertinfo.c
example are in line with that!You up to providing a patch?
ethomson commentedon Jun 1, 2016
I can send a PR for the docs and updating the example. There is much magic in the
typecheck-gcc.h
though and I regret that I don't have time to decipher that. If I provide a PR for the first two can you assist with the latter?bagder commentedon Jun 1, 2016
I poked around at it earlier today and while I can certainly see what changes that need to get done, the entire typecheck logic doesn't really seem to work for me at all at the moment (I tried gcc 5.3.1 as as well as 4.7) so I'm a bit puzzled. I haven't figured out why yet.
Applying the patch below fixes the example but causes no warning for me with an unmodified typecheck-gcc.h file.
ethomson commentedon Jun 1, 2016
Yeah, I was running into the same problem. I don't see these warning on any of my machines, only when running on gcc on travis. I wasn't able to dig in deeply enough to know what's different about their setup than mine.
Update libcurl from 7.50.1 to 7.54.1.