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