title: Getting "411 Length Required" after a PUT request from HTTP Client
body: <p>I am working on a Java program that implements an HTTP Client.
  I test it sending requests to a server. GET, POST and DELETE requests work ok.
  For example after a POST request I get an output</p>
  
  <pre><code>Data extracted:
  {"status":{"message":"ok"}}
  </code></pre>
  
  <p>and the database reflects the changes made.</p>
  
  <p>After a PUT request, however I get the following html markup of a webpage indicating an error.</p>
  
  <pre><code>Data extracted:
  &lt;html&gt;
  &lt;head&gt;&lt;title&gt;411 Length Required&lt;/title&gt;&lt;/head&gt;
  &lt;body bgcolor="white"&gt;
  &lt;center&gt;&lt;h1&gt;411 Length Required&lt;/h1&gt;&lt;/center&gt;
  &lt;hr&gt;&lt;center&gt;nginx/1.2.6&lt;/center&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and accordingly no changes in the database.</p>
  
  <p>I found that this can have something to do with the Content-Length header, but I'm not sure.
  After trying to add this header my program waits for a minute and then throws an exception informing that it couldn't handle the server response.</p>
  
  <p>I can also provide any code or stack trace if needed.</p>