在使用PUT发送请求时,代码逻辑是根据消息体的长度设置的,当没有消息体时,就会跳过设置消息长度这步,这时发出去的请求会返回
<html>
<head><title>411 Length Required</title></head>
<body bgcolor="white">
<center><h1>411 Length Required</h1></center>
<hr><center>nginx/1.2.6</center>
</body>
</html>
我还以为是服务端把页面给我发回来了呢,仔细一看“Length Required”,才发现代码存在这个缺陷,第一次遇到这种问题,记录下来!
参考文章:
http://stackoverflow.com/questions/15619562/getting-411-length-required-after-a-put-request-from-http-client
本文详细介绍了在使用PUT发送请求时,由于未设置消息体长度而导致返回411LengthRequired错误的原因及解决办法,通过实例分析帮助理解HTTP协议中此错误的含义,并提供代码优化建议。

212

被折叠的 条评论
为什么被折叠?



