[wp-trac] [WordPress Trac] #22913: Files "corrupted" when streamed to file via HTTP API (was: Plugin Updater fails behind HTTP Proxy)

WordPress Trac noreply at wordpress.org
Fri Dec 21 06:56:57 UTC 2012

#22913: Files "corrupted" when streamed to file via HTTP API
 Reporter:  samthorne     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  HTTP          |     Version:  3.2
 Severity:  normal        |  Resolution:
 Keywords:                |
Changes (by dd32):

 * component:  Upgrade/Install => HTTP
 * version:  3.5 => 3.2
 * milestone:  Awaiting Review => Future Release


 > Hope this helps.

 It does, it helps a lot!

 Unfortunately, it points out a rather large insufficiency in the way we're
 "streaming" http downloads to file, rather than storing them within memory
 and then writing them out.

 [body] => 11507: 504b03040a0000000000
 As you can see by that, when we're not doing streaming to file, the hex
 header of the data received is 50 4B 03 04. That's the standard Zip file
 header. The header of the downloaded archive you've provided is 48 0D 0A
 F0 - Thats a Huffman encoded compressed document, within that compressed
 document, we'll find the ZIP archive..
 So basically, the HTTP API is saving the *raw* received data, rather than
 the decompressed data.

 For most hosts, this isn't a problem, as the !WordPress.org servers don't
 attempt to further compress compressed documents, but for those which go
 through a proxy, the proxy may legitimately compress the document,
 resulting in us saving a compressed document to disk.

 For example the header:
  [content-encoding] => deflate
 isn't added by !WordPress.org, rather, it's added by the local proxy

 Introduced in 3.2 in #16236, Moving to future release pending working out
 a work around.

Ticket URL: <http://core.trac.wordpress.org/ticket/22913#comment:4>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software

More information about the wp-trac mailing list