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

Support for Case Insensitive Schemes #181

Open
mijho opened this issue Nov 18, 2024 · 1 comment
Open

Support for Case Insensitive Schemes #181

mijho opened this issue Nov 18, 2024 · 1 comment

Comments

@mijho
Copy link

mijho commented Nov 18, 2024

We've come across some sites where the scheme's are capitalised, as wombat expects these to be lower cased they are not re-written.

I'm happy to put in a PR for this but before doing the work thought I should ask whether you'd want wombat to handle scheme's case insensitively first?

From RFC 3986:

Scheme names consist of a sequence of characters beginning with a
letter and followed by any combination of letters, digits, plus
("+"), period ("."), or hyphen ("-"). Although schemes are case-
insensitive, the canonical form is lowercase and documents that
specify schemes must do so with lowercase letters. An implementation
should accept uppercase letters as equivalent to lowercase in scheme
names (e.g., allow "HTTP" as well as "http") for the sake of
robustness but should only produce lowercase scheme names for
consistency.

If you'd like support for this would you prefer for it to be added via a regex patten match or via explicitly adding the additional options?

this.HTTP_PREFIX = 'http://';

@ikreymer
Copy link
Member

Thanks for filing this! Probably the simplest option is to add a .toLowerCase() when doing checks for VALID_PREFIXES, HTTP_PREFIX or HTTPS_PREFIX. If you can submit a PR for that, would be happy to accept!

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

No branches or pull requests

2 participants