Repository navigation
fix(link): unwrap stacked schemes split by whitespace in one pass [3.x] - #253
Merged
Merged
Conversation
A domain-variant link that stacked http schemes with whitespace between them re-entered normalize() once per scheme, so a 2,048 character value took about 250 passes and 47 ms. A separator that trim() leaves in place, such as a non-breaking space, came back unparsed. The unwrap now skips the whitespace between schemes, so every stacked form resolves in two passes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
A domain-variant link that stacks http schemes with whitespace between them re-enters
LinkFieldType::normalize()once per scheme. A 2,048 character value, the longest the item rule allows, takes about 250 passes and 47 ms. A host app that normalizes filter operands or import rows with this method pays that for every value.A separator that
trim()leaves in place, such as a non-breaking space or a zero-width space, also came back unparsed.Change
The unwrap regex skips the whitespace between stacked schemes, using the same class the authority parse already strips. Every stacked form now resolves in at most two passes.
Measured
http://Tests
No stored value changes shape, so no upgrade step is needed.