[wp-trac] [WordPress Trac] #18273: Flaw in WP_Http_Encoding::accept_encoding() or related.
WordPress Trac
wp-trac at lists.automattic.com
Mon Sep 19 14:54:45 UTC 2011
#18273: Flaw in WP_Http_Encoding::accept_encoding() or related.
--------------------------+-----------------------
Reporter: jfarthing84 | Owner: dd32
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 3.3
Component: HTTP | Version: 3.2.1
Severity: normal | Resolution:
Keywords: |
--------------------------+-----------------------
Comment (by dd32):
> Can we have some more detail
I was in the process of writing that comment :)
After getting my hands on a Mailchimp API key, I did some brute force
decoding on the data.
{{{
while ( $i <= strlen($gzData) ) {
$decompressed = @gzinflate( substr($gzData, $i) );
if ( false !== $decompressed ) {
echo "You need $i!";
return $decompressed;
}
}
}}}
turns out, 2 is the magical number, as some others have
[http://www.navioo.com/php/docs/function.gzinflate.php also found] and
[http://wordpress.stackexchange.com/questions/10088/how-do-i-troubleshoot-
responses-with-wp-http-api Stack Exchange post on Mailchimp API +
wp_remote_post() not returning properly]
> What are the errors we are suppressing here? Do we really need to
suppress them?
Unfortunately yes, As done elsewhere in that class, the PHP decompression
functions issue warnings when it can't decompress the data, and we can't
know if it can decompress the data without trying.
The first case there which I added the @ to, hasn't (to my knowledge)
errored out before, as if the data stream starts with that header, it's
reasonably reliable to expect it to decode it - but if there's a data
error(ie. incomplete transmission), it'll issue warnings. Same for the
added case for 2, it'll issue a warning if it's not compressed with that
specific compressor.
I'd also like to note, that I don't like it returning compressed data when
it can't decompress it..
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18273#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list