Skip to content

Use CURLOPT_PROTOCOLS_STR where available - #50

Merged
eafer merged 1 commit into
eafer:masterfrom
nfvelten:fix/curlopt-protocols-str
Aug 31, 2026
Merged

Use CURLOPT_PROTOCOLS_STR where available#50
eafer merged 1 commit into
eafer:masterfrom
nfvelten:fix/curlopt-protocols-str

Conversation

@nfvelten

@nfvelten nfvelten commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #38.

CURLOPT_PROTOCOLS is deprecated since libcurl 7.85.0, so building against a recent libcurl warns. This switches to CURLOPT_PROTOCOLS_STR behind a CURL_AT_LEAST_VERSION(7, 85, 0) check, so older libcurl keeps the old call. That was the blocker you mentioned in the issue, where your distro did not have the new option yet.

The allowed set is unchanged: http, https and file.

Checked on libcurl 8.21.0:

  • diffing the build warnings before and after, the only difference is the CURLOPT_PROTOCOLS deprecation disappearing, and nothing new shows up
  • forcing the legacy branch on with #if 0 still compiles, with no unused variable warning, so the guard around long protocols is needed and correct
  • https:// and file:// still fetch and extract, and ftp:// is still refused with Protocol "ftp" is disabled

tests/check does not pass in my environment, but it fails byte for byte identically with and without this patch, so it is unrelated to the change. rdrview writes no dump output when it has no controlling terminal here, which is what the test compares.

CURLOPT_PROTOCOLS has been deprecated since libcurl 7.85.0, so building
against a recent libcurl warns. Switch to CURLOPT_PROTOCOLS_STR, keeping
the old call behind a version check so older libcurl still builds.

The allowed set is unchanged: http, https and file.
@eafer
eafer merged commit 4f79cf4 into eafer:master Aug 31, 2026
@eafer

eafer commented Aug 31, 2026

Copy link
Copy Markdown
Owner

Thanks! The tests have been broken for a while now, because libxml2 now assumes a different character encoding when the html header is missing. I should get around to fixing them at some point.

@nfvelten

Copy link
Copy Markdown
Contributor Author

Glad to help, and thanks for merging it.

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.

‘CURLOPT_PROTOCOLS’ is deprecated

2 participants