Username/password in the URL not decoded when used for basic authentication
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- authentication, cli
调研方向
首先使用提供的 HTTPie 命令复现该问题,并跟踪 URL userinfo 如何传入 basic authentication。当用户名和密码中的 percent-encoded 字符被解码用于身份验证,且复现返回预期的 200 响应时,工作即告完成。
由索引模型根据 Issue 内容生成。
描述
Checklist
- I've searched for similar issues.
- I'm using the latest version of HTTPie.
Minimal reproduction code and steps
Run http https://u%40d:1%3d2%3f@httpbin.org/basic-auth/u%40d/1%3d2%3f.
Current result
401 status is returned because HTTPie tries to authenticate using u%40d username instead of the expected u@d (and wrong password, too, for the same reason).
Expected result
Same as from running http -a 'u@d:1=2?' https://httpbin.org/basic-auth/u%40d/1%3d2%3f, i.e. 200 status response.
Debug output
Please re-run the command with --debug, then copy the entire command & output and paste both below:
$ http --debug https://u%40d:1%3d2%3f@httpbin.org/basic-auth/u%40d/1%3d2%3f
HTTPie 3.2.4
Requests 2.32.3
Pygments 2.19.1
Python 3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0]
/home/zeitlin/python/3.11/bin/python3
Linux 6.7.9-amd64
<Environment {'apply_warnings_filter': <function Environment.apply_warnings_filter at 0x7ff3af8a0720>,
'args': Namespace(),
'as_silent': <function Environment.as_silent at 0x7ff3af8a05e0>,
'colors': 256,
'config': {'default_options': []},
'config_dir': PosixPath('/home/zeitlin/.config/httpie'),
'devnull': <property object at 0x7ff3af87d4e0>,
'is_windows': False,
'log_error': <function Environment.log_error at 0x7ff3af8a0680>,
'program_name': 'http',
'quiet': 0,
'rich_console': <functools.cached_property object at 0x7ff3af8916d0>,
'rich_error_console': <functools.cached_property object at 0x7ff3af891750>,
'show_displays': True,
'stderr': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>,
'stderr_isatty': False,
'stdin': <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>,
'stdin_encoding': 'utf-8',
'stdin_isatty': True,
'stdout': <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>,
'stdout_encoding': 'utf-8',
'stdout_isatty': False}>
<PluginManager {'adapters': [],
'auth': [<class 'httpie.plugins.builtin.BasicAuthPlugin'>,
<class 'httpie.plugins.builtin.DigestAuthPlugin'>,
<class 'httpie.plugins.builtin.BearerAuthPlugin'>],
'converters': [],
'formatters': [<class 'httpie.output.formatters.headers.HeadersFormatter'>,
<class 'httpie.output.formatters.json.JSONFormatter'>,
<class 'httpie.output.formatters.xml.XMLFormatter'>,
<class 'httpie.output.formatters.colors.ColorFormatter'>]}>
>>> requests.request(**{'auth': <httpie.plugins.builtin.HTTPBasicAuth object at 0x7ff3afd8aa90>,
'data': RequestJSONDataDict(),
'headers': <HTTPHeadersDict('User-Agent': b'HTTPie/3.2.4')>,
'method': 'get',
'params': <generator object MultiValueOrderedDict.items at 0x7ff3af36a640>,
'url': 'https://u%40d:1%3d2%3f@httpbin.org/basic-auth/u%40d/1%3d2%3f'})
Additional information, screenshots, or code examples
I believe HTTPie should decode percent-encoded characters in the userinfo part of the URL. Curl does it and, well, it just makes sense: otherwise user names containing reserved characters simply can't be specified directly in the URL.
This is a minor problem, because using --auth works, but I think it's surprising and confusing that using them directly in the URL does not (at least it confused me).
- 主要语言
- Python
- 星标
- 38.6k
- 派生
- 4k
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
httpie/cli 的其他 Issue
-
new
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 78/100
-
bug new
难度 4/5 3-5 天 新手友好度 48/100
-
难度 3/5 1-2 天 新手友好度 55/100
-
难度 4/5 3-5 天 新手友好度 35/100
相似的 Issue
-
agent-ready documentation needs-triage
难度 1/5 1-3 小时 新手友好度 88/100
-
documentation
难度 1/5 1 小时以内 新手友好度 91/100
-
workflow-status page template still says reusable workflows are "triggered only by workflow_call:" 未关闭
难度 1/5 1 小时以内 新手友好度 92/100
-
instance instance add
难度 1/5 1 小时以内 新手友好度 72/100
searxng/searx-instances#939 · 1 条评论 ·
-
area-deployment area-integrations triage:bot-seen
难度 2/5 半天 新手友好度 86/100