Skip to content

Conversation

xgedev
Copy link

@xgedev xgedev commented Sep 19, 2025

Setting an IPv6 URL as a DSN does not work, see #2996.
This updates the DSN_REGEX to correctly match IPv6 and fixes the then occuring issue that the brackets "[" and "]" are in the request's hostname and prevent the request from being made.


/** Regular expression used to parse a Dsn. */
const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;
const DSN_REGEX = /^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)((?:\[[0-9a-fA-F:]+\]|[\w.-]+))(?::(\d+))?\/(.+)/;
Copy link

Choose a reason for hiding this comment

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

Bug: IPv6 DSN Parsing Fails for Mapped Addresses

The DSN_REGEX update for IPv6 addresses is too restrictive. The IPv6 host pattern [0-9a-fA-F:]+ is missing dots for IPv4-mapped IPv6 addresses and percent signs for zone identifiers, causing valid DSNs with these formats to fail parsing.

Fix in Cursor Fix in Web

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.

1 participant