Skip to content

Fix caBundle being dropped when a Curl handle is moved - #66

Merged
connormanning merged 1 commit into
connormanning:masterfrom
PaulThompson:fix-curl-ca-bundle
Oct 30, 2026
Merged

connormanning merged 1 commit into
connormanning:masterfrom
PaulThompson:fix-curl-ca-bundle

Conversation

@PaulThompson

@PaulThompson PaulThompson commented Oct 29, 2026 •

Copy link
Copy Markdown

Discovered & worked-around during testing for #64.

I had built a static test binary but ran on a different distro on the test EC2 instance, so the CA file was in a different location than the static libcurl's built-in default. So I needed to declare the CA.
It worked using CURL_CA_INFO but not CURL_CA_BUNDLE.

Reproduced locally with an HTTPS S3 stub signed by a private CA. Results, with the CA given only by the listed variable:

case before 5046813 master 3e5dde7 fix f7152a9
CURL_CA_INFO (control) ok ok ok
CURL_CA_BUNDLE ok fail ok
ARBITER_CA_BUNDLE ok fail ok
no CA (control) fail fail fail

The move constructor Curl::Curl(Curl&& other) added in #60 doesn't move m_caBundle, the member added in #61 (they were open at the same time).
The fix adds the move for the m_caBundle member in the move constructor.

The move constructor runs because Pool builds its handles one at a time with m_curls.emplace_back(...), and when the vector grows the handles already in it are moved and lose the setting.

Acknowledgement: Claude Opus 5.5 spotted CURL_CA_BUNDLE being ignored during the #64 EC2 testing, traced it to the move constructor, wrote this one-line change, and added the CA cases to the local test harness.

Curl's move constructor (from connormanning#60) moved m_caPath, m_caInfo and m_proxy
but not m_caBundle (added in connormanning#61). Pool fills m_curls with emplace_back,
so the handles moved on reallocation lose the bundle:

- CURL_CA_BUNDLE, ARBITER_CA_BUNDLE and http.caBundle are ignored on
  those handles, and curl falls back to its default CA file
- CURL_CA_INFO / http.caInfo are unaffected

Tested against a local HTTPS S3 stub signed by a private CA, with the
CA given only via CURL_CA_BUNDLE or ARBITER_CA_BUNDLE: 5046813 (before
connormanning#60) fetches the object, master (3e5dde7) fails the TLS handshake, this
commit fetches it.
@connormanning
connormanning merged commit b2b8854 into connormanning:master Oct 30, 2026
2 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.

2 participants