HTTP Bad chunk header 和 Illegal or missing hexadecimal sequence in chunked-encoding 解决方法
HTTP About 737 words错误信息
错误一
org.apache.http.MalformedChunkCodingException: Bad chunk header: {"a":["b"],"c":["d"]}
错误二
curl: (56) Illegal or missing hexadecimal sequence in chunked-encoding
原因
Connection: close
必须放在Header
中的最后一段。解析HTTP
报文时,解析到Connection: close
就不再继续解析之后的报文。
错误示例
< HTTP/1.1 400
< Connection: close
< Date: Thu, 13 Oct 2022 06:02:01 GMT
< Transfer-Encoding: chunked
< Content-Type: application/json
<
{ [21 bytes data]
正确示例
< HTTP/1.1 400
< Date: Thu, 13 Oct 2022 06:02:15 GMT
< Transfer-Encoding: chunked
< Content-Type: application/json
< Connection: close
<
{ [27 bytes data]
备注
400
错误:默认Connection
为close
401
错误:默认onnection
为keep-alive
参考
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection
Views: 2,033 · Posted: 2023-03-14
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...