go
protocol_error
ai_generated
true
http: ContentLength=0 with Body length 0
ID: go/http-missing-content-length
80%Fix Rate
81%Confidence
0Evidence
2024-08-30First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1.20 | active | — | — | — |
Root Cause
The server expects a non-zero ContentLength but the request body is empty, causing a protocol violation.
generic中文
服务器期望非零的 ContentLength,但请求体为空,导致协议违规。
Workarounds
-
85% success
Ensure the request body is non-empty or set ContentLength to -1 for chunked encoding.
Dead Ends
Common approaches that don't work:
-
50% fail
This can cause the server to read beyond the body and fail.
-
60% fail
This changes the semantics of the request.