Ticket #11613: 11613.5.diff
File 11613.5.diff, 5.7 KB (added by , 15 years ago) |
---|
-
wp-includes/http.php
94 94 function &_getTransport( $args = array() ) { 95 95 static $working_transport, $blocking_transport, $nonblocking_transport; 96 96 97 if ( is_null($working_transport) ) { 97 $key = join(',', array( 98 isset($args["method"]) ? $args["method"] : 'GET', 99 isset($args["sslverify"]) ? $args["sslverify"] : 1, 100 isset($args["ssl"]) ? $args["ssl"] : '', 101 isset($args["local"]) ? $args["local"] : '' 102 )); 103 if ( !isset($working_transport[$key]) ) { 104 $working_transport[$key] = $blocking_transport[$key] = $nonblocking_transport[$key] = array(); 105 98 106 if ( true === WP_Http_ExtHttp::test($args) ) { 99 $working_transport[ 'exthttp'] = new WP_Http_ExtHttp();100 $blocking_transport[ ] = &$working_transport['exthttp'];107 $working_transport[$key]['exthttp'] = new WP_Http_ExtHttp(); 108 $blocking_transport[$key][] = &$working_transport[$key]['exthttp']; 101 109 } else if ( true === WP_Http_Curl::test($args) ) { 102 $working_transport[ 'curl'] = new WP_Http_Curl();103 $blocking_transport[ ] = &$working_transport['curl'];110 $working_transport[$key]['curl'] = new WP_Http_Curl(); 111 $blocking_transport[$key][] = &$working_transport[$key]['curl']; 104 112 } else if ( true === WP_Http_Streams::test($args) ) { 105 $working_transport[ 'streams'] = new WP_Http_Streams();106 $blocking_transport[ ] = &$working_transport['streams'];113 $working_transport[$key]['streams'] = new WP_Http_Streams(); 114 $blocking_transport[$key][] = &$working_transport[$key]['streams']; 107 115 } else if ( true === WP_Http_Fopen::test($args) ) { 108 $working_transport[ 'fopen'] = new WP_Http_Fopen();109 $blocking_transport[ ] = &$working_transport['fopen'];116 $working_transport[$key]['fopen'] = new WP_Http_Fopen(); 117 $blocking_transport[$key][] = &$working_transport[$key]['fopen']; 110 118 } else if ( true === WP_Http_Fsockopen::test($args) ) { 111 $working_transport[ 'fsockopen'] = new WP_Http_Fsockopen();112 $blocking_transport[ ] = &$working_transport['fsockopen'];119 $working_transport[$key]['fsockopen'] = new WP_Http_Fsockopen(); 120 $blocking_transport[$key][] = &$working_transport[$key]['fsockopen']; 113 121 } 114 122 115 123 foreach ( array('curl', 'streams', 'fopen', 'fsockopen', 'exthttp') as $transport ) { 116 if ( isset($working_transport[$ transport]) )117 $nonblocking_transport[ ] = &$working_transport[$transport];124 if ( isset($working_transport[$key][$transport]) ) 125 $nonblocking_transport[$key][] = &$working_transport[$key][$transport]; 118 126 } 119 127 } 120 128 121 do_action( 'http_transport_get_debug', $working_transport , $blocking_transport, $nonblocking_transport);129 do_action( 'http_transport_get_debug', $working_transport[$key], $blocking_transport[$key], $nonblocking_transport[$key] ); 122 130 123 131 if ( isset($args['blocking']) && !$args['blocking'] ) 124 return $nonblocking_transport ;132 return $nonblocking_transport[$key]; 125 133 else 126 return $blocking_transport ;134 return $blocking_transport[$key]; 127 135 } 128 136 129 137 /** … … 144 152 function &_postTransport( $args = array() ) { 145 153 static $working_transport, $blocking_transport, $nonblocking_transport; 146 154 147 if ( is_null($working_transport) ) { 155 $key = join(',', array( 156 isset($args["method"]) ? $args["method"] : 'POST', 157 isset($args["sslverify"]) ? $args["sslverify"] : 1, 158 isset($args["ssl"]) ? $args["ssl"] : '', 159 isset($args["local"]) ? $args["local"] : '' 160 )); 161 if ( !isset($working_transport[$key]) ) { 162 $working_transport[$key] = $blocking_transport[$key] = $nonblocking_transport[$key] = array(); 163 148 164 if ( true === WP_Http_ExtHttp::test($args) ) { 149 $working_transport[ 'exthttp'] = new WP_Http_ExtHttp();150 $blocking_transport[ ] = &$working_transport['exthttp'];165 $working_transport[$key]['exthttp'] = new WP_Http_ExtHttp(); 166 $blocking_transport[$key][] = &$working_transport[$key]['exthttp']; 151 167 } else if ( true === WP_Http_Curl::test($args) ) { 152 $working_transport[ 'curl'] = new WP_Http_Curl();153 $blocking_transport[ ] = &$working_transport['curl'];168 $working_transport[$key]['curl'] = new WP_Http_Curl(); 169 $blocking_transport[$key][] = &$working_transport[$key]['curl']; 154 170 } else if ( true === WP_Http_Streams::test($args) ) { 155 $working_transport[ 'streams'] = new WP_Http_Streams();156 $blocking_transport[ ] = &$working_transport['streams'];171 $working_transport[$key]['streams'] = new WP_Http_Streams(); 172 $blocking_transport[$key][] = &$working_transport[$key]['streams']; 157 173 } else if ( true === WP_Http_Fsockopen::test($args) ) { 158 $working_transport[ 'fsockopen'] = new WP_Http_Fsockopen();159 $blocking_transport[ ] = &$working_transport['fsockopen'];174 $working_transport[$key]['fsockopen'] = new WP_Http_Fsockopen(); 175 $blocking_transport[$key][] = &$working_transport[$key]['fsockopen']; 160 176 } 161 177 162 178 foreach ( array('curl', 'streams', 'fsockopen', 'exthttp') as $transport ) { 163 if ( isset($working_transport[$ transport]) )164 $nonblocking_transport[ ] = &$working_transport[$transport];179 if ( isset($working_transport[$key][$transport]) ) 180 $nonblocking_transport[$key][] = &$working_transport[$key][$transport]; 165 181 } 166 182 } 167 183 168 do_action( 'http_transport_post_debug', $working_transport , $blocking_transport, $nonblocking_transport);184 do_action( 'http_transport_post_debug', $working_transport[$key], $blocking_transport[$key], $nonblocking_transport[$key] ); 169 185 170 186 if ( isset($args['blocking']) && !$args['blocking'] ) 171 return $nonblocking_transport ;187 return $nonblocking_transport[$key]; 172 188 else 173 return $blocking_transport ;189 return $blocking_transport[$key]; 174 190 } 175 191 176 192 /**