在使用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