Credentials::decode() should return Result instead of Option
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- rust
- 领域
- api, authentication
调研方向
Start by locating the Credentials::decode() and Basic::decode() implementations and any tests covering malformed Basic authentication headers. Trace the current panic for a value such as "Bazic xxx"; done means invalid input returns an Err through the requested Result-based API instead of panicking, with tests covering the behavior.
由索引模型根据 Issue 内容生成。
描述
I'm using "headers" together with warp to decode basic auth headers. With the current behaviour, my web server would panic if the header value does not start with "Basic ".
It would be great in my opinion if Credentials::decode() could return a Result instead of an Option. In the above use case, Basic::decode() would return an Err instead of panicking.
Current behavior:
let header_value = http::header::HeaderValue::from_static("Bazic xxx");
let basic = Basic::decode(&header_value); // panic
Feature request (with error handling):
let header_value = http::header::HeaderValue::from_static("Bazic xxx");
let basic = Basic::decode(&header_value).map_err(...)?; // proper error handling
- 主要语言
- Rust
- 星标
- 200
- 派生
- 108
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
hyperium/headers 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 62/100
-
Range::bytes and ContentRange::bytes do unchecked u64 arithmetic on bounds可能已有人在做 @youdie006 于 58 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 78/100
-
From<SystemTime> for HttpDate panics on times before 1970 or after year 9999可能已有人在做 @SAY-5 于 77 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 48/100
-
难度 5/5 一周以上 新手友好度 35/100
-
Link support未关闭
难度 4/5 3-5 天 新手友好度 38/100
相似的 Issue
-
llm translation
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
area: backend type: enhancement
难度 2/5 1-3 小时 新手友好度 61/100
armadavalor/WinKnife#6 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
-
难度 2/5 1-3 小时 新手友好度 78/100
5omeOtherGuy/phaseone#870 ·
维护者通常 1 天内回复
-
难度 1/5 1-3 小时 新手友好度 72/100
MattA-Official/vwmcp#20 ·