title: download a file properly with python if no Content-Length is provided
body: <p>how can i properly download a file with python if the http response does not contain a Content-Length header?</p>
  
  <p>im having this issue with appengine's send_blob() function which for some reason does not add the Content-Length header on bigger (20mb+) blobs.</p>
  
  <p>right now im using urllib.urlretrieve() but sometimes it does not download the whole file. 
  what im doing right now is sending the content length before downloading the file so i can check if the file has the right size before proceeding.</p>
  
  <p>im not sure if there is a better way to do this.</p>
  
  <p>the headers of one of those files:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Cache-Control: no-cache
  Content-Type: application/octet-stream
  Expires: Fri, 01 Jan 1990 00:00:00 GMT
  Date: Fri, 30 Sep 2011 19:41:34 GMT
  Server: Google Frontend
  Transfer-Encoding: Identity
  Connection: close
  </code></pre>
  
  <p>i just tried to use wget to download a file with <code>wget --server-response --continue</code> and the headers are:</p>
  
  <pre><code>  HTTP/1.1 200 OK
    Cache-Control: no-cache
    Content-Type: application/octet-stream
    Expires: Fri, 01 Jan 1990 00:00:00 GMT
    Date: Wed, 05 Oct 2011 14:08:13 GMT
    Server: Google Frontend
    Transfer-Encoding: chunked
  Length: unspecified [application/octet-stream]
  </code></pre>