[wp-trac] [WordPress Trac] #22952: WP_HTTP can cause PHP Warnings during attempted decompression

WordPress Trac noreply at wordpress.org
Sat Dec 15 05:24:27 UTC 2012


#22952: WP_HTTP can cause PHP Warnings during attempted decompression
-------------------------------------+------------------
 Reporter:  dd32                     |       Owner:
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  3.6
Component:  HTTP                     |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |
-------------------------------------+------------------

Comment (by dd32):

 I have also considered that we're using gzinflate() completely wrong, for
 example:

 * gzencode() == gzip
 * gzcompress() == zlib (aka. HTTP deflate)
 * gzdeflate()  == *raw* deflate encoding

 Currently we use gzinflate() (the raw DEFLATE standard) to decompress the
 data created by compressors which add their compression header/footer
 wrappers.[[BR]]
 gzuncompress() for example handles Huffman encoding internally, as it's
 designed for uncompressing HTTP "deflated" content.[[BR]]
 gzdecode() on the other hand is designed for gzip encoded files (which
 uses DEFLATE internally as the compression method) which has it's own
 headers (as it's designed for multiple files stored within the archive) -
 I believe this is the appropriate function to decompress data for the
 block above the changes in WP_Http_Encoding::compatible_gzinflate() which
 strips the full zlib headers

 Ultimately, we've been bitten by poor implementations from other web
 servers and software many times, which has lead me to disregarding the
 above and continuing forward and detecting it ourselves and striping the
 Huffman headers which gzinflate() can't handle. The changes here are 100%
 backwards compatible so far.

 This still has the possibility of generating warnings (which are silenced
 by all those @'s) but significantly reduces the number of configurations
 which might cause one.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22952#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list