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