python-hyper / python-hyper/rfc3986
Resolution result is not consistent with RFC 3986 when the base has "rootless" path without authority
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 189
- Forks
- 38
- Avg merge
- 13h 36m
- Merged PRs (30d)
- 1
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the RFC 3986 section 5.2.4 rules and the uri_reference, resolve_with, and remove_dot_segments entry points. Reproduce the example resolving ../baz against scheme:foo/bar; done means the result unsplits as scheme:/baz while preserving existing resolution behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100