WordPress.org

Make WordPress Core

Changeset 12739


Ignore:
Timestamp:
01/16/10 23:11:28 (4 years ago)
Author:
dd32
Message:

Correctly set the body on Curl requests with an empty body. Add a defensive check to WP_Http_Encoding::decompress to prevent the decompression functions running on empty strings. Fixes #11912

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/http.php

    r12642 r12739  
    13611361            $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE); 
    13621362            $theHeaders = trim( substr($theResponse, 0, $headerLength) ); 
    1363             $theBody = substr( $theResponse, $headerLength ); 
     1363            if ( strlen($theResponse) > $headerLength ) 
     1364                $theBody = substr( $theResponse, $headerLength ); 
     1365            else 
     1366                $theBody = ''; 
    13641367            if ( false !== strrpos($theHeaders, "\r\n\r\n") ) { 
    13651368                $headerParts = explode("\r\n\r\n", $theHeaders); 
     
    18171820     */ 
    18181821    function decompress( $compressed, $length = null ) { 
     1822 
     1823        if ( empty($compressed) ) 
     1824            return $compressed; 
    18191825 
    18201826        if ( false !== ( $decompressed = @gzinflate( $compressed ) ) ) 
Note: See TracChangeset for help on using the changeset viewer.