title: Image Download with PycURL gets me broken Images
body: <p>I'm struggling with pycurl.
  These are my headers:</p>
  
  <pre><code>headers.append('User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/5.0')
  headers.append('Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
  headers.append('Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3')
  headers.append('Accept-Encoding: gzip, deflate')
  headers.append('Accept-Charset: UTF-8,*')
  headers.append('Connection: Keep-Alive')
  </code></pre>
  
  <p>Original: <img src="https://i.stack.imgur.com/hoxfh.jpg" alt="http://dl.dropbox.com/u/25733986/test.jpg"></p>
  
  <p>What I get: <img src="https://i.stack.imgur.com/iCKHw.jpg" alt="http://dl.dropbox.com/u/25733986/test_kaputt.jpg"></p>
  
  <p>As you can see, the one I get with pycurl is broken. If I compare them with a text-compare-tool, it tells me they are the same. (There was a difference in line-endings where the original had only LF and the broken had CRLF, but I changed that and now I have identical images, still broken)</p>
  
  <p>The host where I'm downloading from, is not the reason. I tried to do the same from the dropbox and a local apache. Both didn't work.</p>
  
  <p>This is how I save the image:</p>
  
  <pre><code>self.buffer = StringIO.StringIO()
  # other curl options like ssl, cookies, followlocation and GET Request URL Setup to the Image: http://dl.dropbox.com/u/25733986/test.jpg
  self.curl.setopt(pycurl.WRITEFUNCTION, self.buffer.write)
  # -&gt; curl.perform()
  f = open("temp/resources/%s" % (filename,), 'w')
  f.write(self.buffer.getvalue())
  f.close()
  </code></pre>
  
  <p>I would be happy if anyone has some suggestions on this, so I can find my error.</p>