http-rs / http-rs/async-h1

Decode inserts malformed date header

Open
#193 2 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.