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

urlapi: parse IPv6 literals without ENABLE_IPV6 #10660

wants to merge 1 commit into from


Copy link

As per the discussion on the curl-library mailing list, here is a patch to allow URLs with IPv6 literals to be parsed correctly even when ENABLE_IPV6 is not configured, including when the target lacks the AF_INET6 constant (and other IPv6 definitions).

It simply enables the existing curl IPv6 literal parsing capabilities when ENABLE_IPV6 is not defined, and creates a limited-scope definition of AF_INET6 that the URL and IP parsing code (only) use to communicate. It seemed safer to not define AF_INET6 more widely, and it seemed unnecessarily complex to switch curl to define its own constant and use it, so I took a simple pragmatic approach. Feedback on this detail, including the resulting redefinition of AF_INET6 in a three spots, is welcome.

For tests, I simply relaxed the restrictions on the existing tests to now require IPv6 support. I do not know if any CI runs the tests this way (but I did manually).

I don't have a machine that lacks AF_INET6, so I also simulated that case by undefining it.

All tests passed for me on Linux x86_64.

Copy link

bagder commented Mar 3, 2023


bch pushed a commit to bch/curl that referenced this pull request Jul 19, 2023
This makes the URL parser API stable and working the same way
independently of libcurl supporting IPv6 transfers or not.

Closes curl#10660
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Successfully merging this pull request may close these issues.

None yet

2 participants