Commit 5be13c6
net.http: reject malformed Content-Length in H2Conn
A non-numeric Content-Length value (e.g. '12junk') caused all_digits()
to return false on the combined condition, silently leaving
has_content_length false and skipping the body-length completeness
check. The response was then returned successfully despite the invalid
header.
Split the condition so a present-but-non-numeric value returns a stream
error ('h2: malformed Content-Length: <value>') instead of being
silently ignored. RFC 9113 §8.2.1 requires malformed field values to be
rejected.
Co-Authored-By: WOZCODE <contact@withwoz.com>1 parent 4b2bc70 commit 5be13c6
1 file changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
228 | 228 | | |
229 | 229 | | |
230 | 230 | | |
231 | | - | |
232 | | - | |
233 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
234 | 238 | | |
235 | 239 | | |
236 | 240 | | |
| |||
0 commit comments