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

Fix TrideNode wildcard and regexp management #1002

Merged
merged 1 commit into from
Oct 20, 2023

Conversation

Wonshtrum
Copy link
Member

@Wonshtrum Wonshtrum commented Oct 13, 2023

Add unit test and e2e test for wildcard behavior.
Fix the TrieNode (is_empty, insert, remove, lookup_mut)
Documenting comments and variable renaming in the router module.

lib/src/router/mod.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Keksoj Keksoj left a comment

Choose a reason for hiding this comment

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

looks very good to me!

Copy link
Member Author

@Wonshtrum Wonshtrum left a comment

Choose a reason for hiding this comment

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

ABORT! This doesn't work!

Copy link
Contributor

@Keksoj Keksoj left a comment

Choose a reason for hiding this comment

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

well if it doesn't work, let's block the merge

@Wonshtrum Wonshtrum force-pushed the devel/edemolis/fix/wildcards branch from b9be971 to 80bac33 Compare October 16, 2023 10:46
@Wonshtrum Wonshtrum changed the title Fix wildcard management in domain rules Fix TrideNode wildcard and regexp management Oct 16, 2023
@Wonshtrum
Copy link
Member Author

The problem was more profound than previously thought.
TLDR: lookup_mut and lookup had the same behavior (apart from mutability), but are used very differently:

  • lookup is only used to check "real complete" URLs against the trie tree.
  • lookup_mut can be used with "pattern" URLs (wildcard and regex)

This PR changes lookup_mut to properly support wildcards and regexes in URLs as well as fixing some branches in insert_recursive and remove_recursive which didn't correctly propagate.

lib/src/router/mod.rs Outdated Show resolved Hide resolved
@Wonshtrum Wonshtrum force-pushed the devel/edemolis/fix/wildcards branch from 80bac33 to fc3e492 Compare October 16, 2023 15:27
lib/src/router/pattern_trie.rs Outdated Show resolved Hide resolved
- add unit test and e2e test for wildcard behavior
- fix the TrieNode (is_empty, insert, remove, lookup_mut)
- documenting comments and variable renaming in the router module

Signed-off-by: Eloi DEMOLIS <[email protected]>
@Wonshtrum Wonshtrum force-pushed the devel/edemolis/fix/wildcards branch from fc3e492 to e562299 Compare October 17, 2023 14:56
@FlorentinDUBOIS FlorentinDUBOIS merged commit 2760078 into main Oct 20, 2023
13 checks passed
@FlorentinDUBOIS FlorentinDUBOIS deleted the devel/edemolis/fix/wildcards branch October 20, 2023 08:33
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.

3 participants