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

Scheme-based normalization #27

Open
Stranger6667 opened this issue Sep 29, 2024 · 2 comments
Open

Scheme-based normalization #27

Stranger6667 opened this issue Sep 29, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@Stranger6667
Copy link

Stranger6667 commented Sep 29, 2024

As far as I see, fluent_uri==0.3.0 normalizes http://example.com and http://example.com:80 to different values and therefore does not consider them equal. My reading of RFC 3986 6.2.3 is that such URIs should be considered equivalent.

For example, because the "http" scheme makes use of an authority component, has a
default port of "80", and defines an empty path to be equivalent to
"/", the following four URIs are equivalent:
http://example.com
http://example.com/
http://example.com:/
http://example.com:80/

Is my understanding correct? If so, would it make sense to adjust the normalization logic in fluent_uri so it matches this semantics?

@yescallop yescallop added the enhancement New feature or request label Sep 29, 2024
@yescallop yescallop changed the title Default port normalization Scheme-based normalization Sep 30, 2024
@yescallop
Copy link
Owner

yescallop commented Oct 12, 2024

I think it would be nice to have a minimal implementation of scheme-based normalization in this library. Would you define the scope of your use case, such as which schemes you need this behavior with, and is it just default port normalization that you need, or do you also need to normalize an empty path to / for HTTP, for example?

@Stranger6667
Copy link
Author

Stranger6667 commented Oct 12, 2024

In my use case, I needed o follow the json schema reference resolution rules that require normalisation. There is a test suite for this behaviour and right now, only default port normalisation tests are failing

https://github.com/python-jsonschema/referencing-suite/blob/main/tests/json-schema-draft-2020-12/rfc3986-normalization-on-retrieval.json

Other than that, the current normalisation fits my needs perfectly! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants