Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an option native_ca to proj.ini and an environment variable PROJ_NATIVE_CA to be able to configure curl to use the operating system CA store. #4356

Merged
merged 9 commits into from
Dec 24, 2024

Conversation

Robrecht-VS
Copy link
Contributor

@Robrecht-VS Robrecht-VS commented Dec 19, 2024

@@ -1622,7 +1627,15 @@ CurlFileHandle::CurlFileHandle(PJ_CONTEXT *ctx, const char *url, CURL *handle)
#if defined(SSL_OPTIONS)
// https://curl.se/libcurl/c/CURLOPT_SSL_OPTIONS.html
auto ssl_options = static_cast<long>(SSL_OPTIONS);
if (pj_context_get_native_ca(ctx)) {
ssl_options = ssl_options | CURLSSLOPT_NATIVE_CA;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From CI failures, it seems that CURLSSLOPT_NATIVE_CA is only available in "recent" Curl versions, so this will need to be conditioned by a #ifdef on the Curl version

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your clarification @rouault , I have committed a fix.

data/proj.ini Show resolved Hide resolved
Robrecht-VS and others added 2 commits December 24, 2024 11:56
CHECK_RET(ctx, curl_easy_setopt(handle, CURLOPT_SSL_OPTIONS, ssl_options));
#else
#if CURL_AT_LEAST_VERSION(7, 71, 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me that this branch ( SSL_OPTIONS not defined but curl >= 7.71) cannot be taken as SSL_OPTIONS is anterior to 7.71

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, SSL_OPTIONS is a preprocessor definition that is specific to PROJ, it is not defined by curl. It was introduced in this pull request: #3936

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah indeed, I missed that. Looks ok then

@rouault rouault added this to the 9.6.0 milestone Dec 24, 2024
@rouault rouault merged commit 68ad9e8 into OSGeo:master Dec 24, 2024
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Possibility to set CURLSSLOPT_NATIVE_CA through proj.ini
2 participants