go
protocol_error
ai_generated
true
http: ContentLength=0 且 Body 长度为 0
http: ContentLength=0 with Body length 0
ID: go/http-missing-content-length
80%修复率
81%置信度
0证据数
2024-08-30首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 1.20 | active | — | — | — |
根因分析
服务器期望非零的 ContentLength,但请求体为空,导致协议违规。
English
The server expects a non-zero ContentLength but the request body is empty, causing a protocol violation.
解决方案
-
85% 成功率
Ensure the request body is non-empty or set ContentLength to -1 for chunked encoding.
无效尝试
常见但无效的做法:
-
50% 失败
This can cause the server to read beyond the body and fail.
-
60% 失败
This changes the semantics of the request.