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

Resolution result is not consistent with RFC 3986 when the base has "rootless" path without authority #84

Open
lo48576 opened this issue Jan 10, 2022 · 0 comments

Comments

@lo48576
Copy link

lo48576 commented Jan 10, 2022

remove_dot_segments defined in RFC 3986 (section 5.2.4) sometimes add a leading slash when the base path is "rootless".

STEP   OUTPUT BUFFER         INPUT BUFFER

 1 :                         foo/../baz
 2E:   foo                   /../baz
 2C:                         /baz
 2E:   /baz

So, resolving ../baz against scheme:foo/bar should result in scheme:/baz.
However, output of this library differs from that.

$ python
Python 3.9.9 (main, Jan 10 2022, 18:52:39)
[GCC 11.2.1 20211127] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from rfc3986 import uri_reference
>>> b = uri_reference('scheme:foo/bar')
>>> r = uri_reference('../baz')
>>> t = r.resolve_with(b)
>>> t
URIReference(scheme='scheme', authority=None, path='baz', query=None, fragment=None)
>>> t.unsplit()
'scheme:baz'
>>>

I think there should be special handling such as "when .. segment appears but output stack is empty, set prepend_slash flag" or something like that.

@lo48576 lo48576 changed the title Resolution result is not consistent with RFC 3986 when the base has "rootless" path Resolution result is not consistent with RFC 3986 when the base has "rootless" path without authority Jan 10, 2022
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

1 participant