title: Read binary data from a POST request in Python truncated
body: <p>I'm sending binary data from java using POST. Here is java code:</p>
  
  <pre><code>URL url = new URL(saveURI);
  HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
  
  urlConnection.setRequestMethod("POST");
  urlConnection.setDoOutput(true);
  urlConnection.setDoInput(true);
  urlConnection.setInstanceFollowRedirects(false);
  urlConnection.setUseCaches(false);
  
  urlConnection.setRequestProperty("Content-Type", "application/octet-stream");
  urlConnection.setRequestProperty("charset", "utf-8");
  urlConnection.setRequestProperty("Content-Length", Integer.toString(length));
  OutputStream out = new BufferedOutputStream(urlConnection.getOutputStream());
  out.write(data);
  out.flush();
  out.close();
  </code></pre>
  
  <p>The size is 150216 bytes. The python code:</p>
  
  <pre><code>#!/usr/bin/env python
  # -*- coding: UTF-8 -*-
  
  import sys
  
  print "Content-Type: text/plain;charset=utf-8"
  print
  
  data = sys.stdin.read()
  print len(data)
  
  profile= profile_pb2.ProtoCharacter()
  profile.ParseFromString(data)
  if profile.IsInitialized():
      ProfileWork.saveProfile(profile)
      print profile.tag
  </code></pre>
  
  <p>Gives me 22. What could be the problem here?</p>
  
  <p><strong>EDIT:</strong> Added more code</p>