Support swapping the underlying URI parser #202
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds the possibility to configure the underlying uri parser used by global_id gem.
For context:
Since URI v1.0.0, the
URI::DEFAULT_PARSERis RFC3986_Parser (original PR, v1.0.0 release which included it). One notable change of the new default parser is that URIs with underscores in the host part are now considered valid (e.g.:foo://foo_bar)On the other hand, since v1.3.0 GlobalID started hardcoding its underlying URI parser to RFC2396_Parser (i.e.: how
URI::DEFAULT_PARSERwas before uri v1 release), in what I suppose to be an effort to keep good compatibility.Also relevant: URI v1 was released in Nov/2024, while GlobalID v1.3.0 was released almost an year later on Sep/2025.
Why?
Hardcoding the parser to RFC2396 on v1.3.0 was a breaking change for us: we started using GlobalID earlier this year and some of our URIs include underscore characters.
Unfortunately it's also not something we can easily change now: some of those now-invalid URIs were included in QR codes which were physically printed and distributed to some of our customers.
related issue(s): #201