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

Permit whatwg URLs for requests #11601

Open
wants to merge 6 commits into
base: 4.9.x
Choose a base branch
from
Open

Permit whatwg URLs for requests #11601

wants to merge 6 commits into from

Conversation

yawkat
Copy link
Member

@yawkat yawkat commented Feb 19, 2025

This PR changes the URL parsing a bit.

  • Introduce a fast path for "boring" valid relative URLs. This is always enabled and lets us skip the expensive URI parsing with default settings.
  • Add a config option that escapes certain characters that are valid in whatwg URLs (e.g. []|, browsers will happily send these) but invalid in java.net.URI. This allows those characters to be handled normally by the server.
  • Remove the option to disable URI validation. The normal path should be fast enough now, and for those that need the whatwg-only characters, there's the new escape config option.

There's also a giant WhatwgParser class in the tests that I implemented while researching a while ago. I don't plan to move it to production code atm, but it remains useful for tests.

@yawkat yawkat added the type: improvement A minor improvement to an existing feature label Feb 19, 2025
@yawkat yawkat added this to the 4.9.0 milestone Feb 19, 2025
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
55.8% Coverage on New Code (required ≥ 70%)
3 New Bugs (required ≤ 0)
1 New Critical Issues (required ≤ 0)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@yawkat yawkat marked this pull request as draft February 20, 2025 18:09
@yawkat
Copy link
Member Author

yawkat commented Feb 20, 2025

i might have to move this to micronaut-router for use there, putting this into draft for now.

@yawkat yawkat marked this pull request as ready for review February 21, 2025 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant