Skip to content

Conversation

@remicollet
Copy link
Member

… enclosed in square brackets

Notice: this is a minimal fix for the regression GH-20528
So GH-8978 is only partially fixed (missing IPv6 address enclosed in square brackets, ex [::1]:3306)

@remicollet remicollet requested review from ndossche and removed request for SakiTakamachi, bukka and kamil-tekiela November 20, 2025 02:01
remicollet referenced this pull request Nov 20, 2025
If there are 2 ports, only the first is used.
However, then the certificate checking fails. So we drop the second port
if there is one.

Closes GH-20021.
@remicollet remicollet changed the base branch from master to PHP-8.3 November 20, 2025 02:08
@remicollet
Copy link
Member Author

Second commit handles IPv6 address enclosed in square brackets

transport.l = mnd_sprintf(&transport.s, 0, "tcp://[%s]:%u", hostname.s, port);
} else {
/* Not ipv6, but could already contain a port number, in which case we should not add an extra port.
char *p;

Choose a reason for hiding this comment

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

This variable could benefit from having a better name.
"P" is not clear and indicates no purpose.

char *p;

/* IPv6 addresses are in the format [address]:port */
if (hostname.s[0] == '[') { /* IPv6 */

Choose a reason for hiding this comment

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

Add a unit test covering this logic

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants