Make WordPress Core

Ticket #16950: 16950.patch

File 16950.patch, 1.2 KB (added by hakre, 15 years ago)

Example Filter on curl_exec in transport

  • wp-includes/class-http.php

    ### Eclipse Workspace Patch 1.0
    #P wordpress-trunk
     
    11471147                // themselves... Although, it is somewhat pointless without some reference.
    11481148                do_action_ref_array( 'http_api_curl', array(&$handle) );
    11491149
     1150                $theResponse = curl_exec( $handle );
     1151                $result = apply_filters( 'curl_transport_exec', array( false, $theResponse, $r ), $handle );
     1152                if ( $result && is_array( $result ) && array_shift( $result ) && 2 === count( $result ) ) {
     1153                        list( $theResponse, $r ) = $result;
     1154                }
     1155
    11501156                // We don't need to return the body, so don't. Just execute request and return.
    11511157                if ( ! $r['blocking'] ) {
    1152                         curl_exec( $handle );
    11531158                        curl_close( $handle );
    11541159                        return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() );
    11551160                }
    11561161
    1157                 $theResponse = curl_exec( $handle );
    1158 
    11591162                if ( !empty($theResponse) ) {
    11601163                        $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
    11611164                        $theHeaders = trim( substr($theResponse, 0, $headerLength) );