Decode inserts malformed date header
- Dominant language
- Rust
- Stars
- 166
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
https://github.com/http-rs/async-h1/blob/dffae5fb497dbead73c3d2c87f4d5f9e6e75b2b3/src/client/decode.rs#L74
I'm seeing date header values like
```
Header date -> [
"date: Wed, 01 Sep 2021 17:42:04 GMT\r\n",
]
```
Where `date: ` and `\r\n` are both included in the value of the header.
I think
```
if res.header(DATE).is_none() {
let date = fmt_http_date(std::time::SystemTime::now());
res.insert_header(DATE, &format!("date: {}\r\n", date)[..]);
}
```
Should be
```
if res.header(DATE).is_none() {
let date = fmt_http_date(std::time::SystemTime::now());
res.insert_header(DATE, &format!("{}", date)[..]);
}
```
Contributor guide
Research direction
Start in src/client/decode.rs around line 74 and inspect the default DATE header insertion path. Confirm the fix by checking that a generated Date header contains only the date value, without the `date: ` prefix or trailing CRLF.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100