python-hyper / python-hyper/rfc3986
The first path segment is unexpectedly interpreted as an authority after normalization
未关闭
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 189
- 派生
- 38
- 平均合并
- 13 小时 36 分钟
- 30 天内合并 PR
- 1
描述
scheme:/..///barhas scheme="scheme", authority=None, path=/..///bar.
However, after normalization, it has scheme="scheme", authority="bar".- Consider t1 as an IRI
..///barresolved againstscheme:.
t1 should have scheme="scheme"and authority=None(since..///bardoes not contain authority).
However, resulting string isscheme://bar, it has authority=bar.
And some more examples:
$ 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:')
>>> r1 = uri_reference('..///bar')
>>> t1 = r1.resolve_with(b)
>>> t1
URIReference(scheme='scheme', authority=None, path='//bar', query=None, fragment=None)
>>> t1.unsplit()
'scheme://bar'
>>> r2 = uri_reference('/..///bar')
>>> r2.resolve_with(b)
URIReference(scheme='scheme', authority=None, path='//bar', query=None, fragment=None)
>>> uri_reference('scheme:/..///bar').normalize()
URIReference(scheme='scheme', authority=None, path='//bar', query=None, fragment=None)
>>> uri_reference('scheme:/..///bar').normalize().unsplit()
'scheme://bar'
I'm not sure how this should handled.
Collapsing the // at the beginning is not explicitly allowed by RFC 3986, so I think the normalization and the resolution cannot produce valid output and should fail in this case.
(But RFC 3986 does not seem to state that they can fail!)
This can caused by normalization during resolution, so #84 may also be affected by this issue.
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 uri_reference() 入口开始,结合 issue 中的示例以及其中引用的 RFC 3986 规则,跟踪 normalize()、resolve_with() 和 unsplit()。确定在不存在 authority 时应如何处理开头的双斜杠,包括与 issue #84 中所指出的交互。完成的标准是:预期行为已得到明确规定,并且示例不再将第一个路径段重新解释为 authority。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend-api-design
- Issue 类型
- 缺陷
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100