Skip to content

feat: support libcurl >= 7.76 - #335

Closed
brainrake wants to merge 6 commits into
masterfrom
feat/support-older-libcurl
Closed

brainrake wants to merge 6 commits into
masterfrom
feat/support-older-libcurl

Conversation

@brainrake

@brainrake brainrake commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Lowers the minimum libcurl from 7.83 to 7.76.

  • Response headers are collected with CURLOPT_HEADERFUNCTION. Only the last response's headers are kept.
  • curl_url_strerror falls back to a generic message below 7.80.
  • Tests: test_get_bad_url and test_http_header_injection accept the older libcurl behavior.
  • The 7.76.1 CI build enables IPv6.
  • README and the version assert are updated.

Closes #283

@brainrake
brainrake marked this pull request as ready for review November 14, 2026 00:24
@brainrake
brainrake requested a review from a team as a code owner November 14, 2026 00:24
@steve-chavez

Copy link
Copy Markdown
Member

An alternative would be restoring the previous parser that didn't require the newer libcurl: c2ba87b#diff-40aa21688f1ac58ddf8ef5f0f4e472e6075411f5c4f75b9c1d512b7e03a2cbabL91-L122. Plus enable it conditionally when the newer libcurl is not available.

That would still cause worker crashes on malformed headers but users that want the fix could upgrade.

@AndrewJackson2020
AndrewJackson2020 force-pushed the feat/support-older-libcurl branch 4 times, most recently from edbdcb0 to b3c399f Compare November 23, 2026 05:28
AndrewJackson2020 and others added 3 commits November 22, 2026 23:30
Collect response headers with CURLOPT_HEADERFUNCTION instead of
curl_easy_nextheader and curl_easy_header, which need libcurl 7.83.
Fall back to a generic message where curl_url_strerror is missing.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@AndrewJackson2020
AndrewJackson2020 force-pushed the feat/support-older-libcurl branch from b3c399f to 586ec3e Compare November 23, 2026 05:31
@AndrewJackson2020

Copy link
Copy Markdown
Contributor

I went ahead and added some CI testing to this PR. Looks like the CI for curl 1.76.1 is failing 3 tests consistently, checked locally.

FAILED test/test_http_errors.py::test_get_bad_url - assert 'Unsupported URL scheme' 
FAILED test/test_http_get_collect.py::test_http_get_ipv6 - AssertionError: assert None == 'Hello ipv6 only\n'
FAILED test/test_http_malformed_headers.py::test_http_header_injection - AssertionError: assert 'SUCCESS' == 'ERROR'

brainrake and others added 2 commits November 23, 2026 14:30
Fail a response with a header line that has no colon, as libcurl 7.83
does. Do not depend on the URL error text, which differs by version.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@brainrake

brainrake commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the CI job. I updated the code to fix the two of the failures.

  • Header line without a colon: 7.83+ fails the request with "Weird server reply", 7.76 passes it through. The header callback now flags it and reports the same error.
  • test_get_bad_url: 7.76 reports "Malformed input" instead of "Unsupported URL scheme". The test checks the invalid URL prefix only.
  • test_http_get_ipv6: passes for me on Rocky 9 with 7.76.1. Investigating nix build. Not changed.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@brainrake

Copy link
Copy Markdown
Contributor Author

test_http_get_ipv6: the nix curl 7.76.1 was built without IPv6, so localhost resolved to 127.0.0.1 only. Enabled it in flake.nix.

@brainrake

Copy link
Copy Markdown
Contributor Author

@AndrewJackson2020 I think we addressed all the problems. Please review.

@AndrewJackson2020

AndrewJackson2020 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

@AndrewJackson2020 I think we addressed all the problems. Please review.

Thank you for fixing.

An alternative would be restoring the previous parser that didn't require the newer libcurl: c2ba87b#diff-40aa21688f1ac58ddf8ef5f0f4e472e6075411f5c4f75b9c1d512b7e03a2cbabL91-L122. Plus enable it conditionally when the newer libcurl is not available.

That would still cause worker crashes on malformed headers but users that want the fix could upgrade.

That is easy to say on the Supabase platform but outside of that context users of rocky 9 linux (for example) will be stuck with crashes until 2032. In many organizations "just upgrade libcurl" is not an option.

While I like the idea of conditionally enabling the new behavior it does increase overall complexity. On the one hand using curl_easy_header is safer and once available on LTS will allow us to shed 40 LOC, on the other hand we are now responsible for 2 different implementations of header parsing until 2032. Maybe this is okay because now we have CI that covers old and now methods.

Right now I'm leaning towards the conditional implementation that you are describing.

[0] https://docs.rockylinux.org/10/releases/

@steve-chavez

Copy link
Copy Markdown
Member

In many organizations "just upgrade libcurl" is not an option.

Hm, the same argument can be applied for us supporting pg_net on pg versions older than 14 yet we don't do it.

That is easy to say on the Supabase platform but outside of that context users of rocky 9 linux (for example) will be stuck with crashes until 2032.

Even Ubuntu 22.04 (released on 2022) has the required libcurl (7.81.0-1ubuntu1.30). Note that there's already a lot of care put for non-Supabase deployments, that's one of the reasons pg_net is packaged on PGDG and others like pigsty.

I'm not sure about the state of rockylinux, but we have to pick our battles otherwise where going to be left with much legacy to support. libcurl 7.80 was released on 2021 and given the recent influx of CVEs it had maybe that will also push more stable distros to upgrade faster?

My proposal would be to just keep enforcing the libcurl version. And if #283 is also a problem on the supabase platform, that can surely be solved by Nix?

@AndrewJackson2020

AndrewJackson2020 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

I'm not sure about the state of rockylinux, but we have to pick our battles otherwise where going to be left with much legacy to support.

Rockylinux is basically just RHEL. Very popular in non tech enterprise environments. I would say RHEL and Debian are probably the 2 most important/widespread linux distros and in an ideal world we would support any non EOL'd distros for both. That said I have not been in a rush to close this gap because of the downsides (extra CI job, more code written by us, etc).

libcurl 7.80 was released on 2021 and given the recent influx of CVEs it had maybe that will also push more stable distros to upgrade faster?

The LTS distros, like rockylinux, will backpatch CVE fixes implemented on more recent releases of software without any of the breaking changes associated with new functionality so the recent influx of CVE's is not an issue as long as they keep up with that work. See for example their gitlab repo with various curl patches [0].

Hm, the same argument can be applied for us supporting pg_net on pg versions older than 14 yet we don't do it.

The difference is that our policy is that we only support postgres that is within the official EOL guidelines, which means postgres >= 14 [1]. This policy of ours currently stops with postgres though, currently we require bleeding edge libcurl. With this PR (and with the supautils PR [2]) we are basically saying that we extend this policy to LTS linux distros.

[0] https://gitlab.com/redhat/centos-stream/rpms/curl
[1] https://www.postgresql.org/support/versioning/
[2] supabase/supautils#278

@steve-chavez

Copy link
Copy Markdown
Member

we are basically saying that we extend this policy to LTS linux distros.

Thanks for elaborating, I understand the motivation now.

Right now I'm leaning towards the conditional implementation that you are describing.

If it's only about building on more platforms, I think we should go with the option I mentioned above and just bring the old parser back where the malformed bug is present. Otherwise we'd have to keep maintaining that new parser if new bugs arise.

Possibly we can raise a warning telling users the newer libcurl version is recommended too.

@brainrake

Copy link
Copy Markdown
Contributor Author

Closing pending pg_net backport decision. Feel free to reopen.

@brainrake brainrake closed this Nov 23, 2026
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.

Support Older LibCurl Builds

3 participants