Ticket #4779: 4779.r8522.diff
File 4779.r8522.diff, 2.4 KB (added by , 15 years ago) |
---|
-
http.php
313 313 /** 314 314 * Transform header string into an array. 315 315 * 316 * If an array is given, then it will be immediately passed through with no 317 * changes. This is to prevent overhead in processing headers that don't 318 * need to be processed. That and it is unknown what kind of effect 319 * processing the array will have since there is no checking done on whether 320 * ':' does not exist within the array string. 316 * If an array is given then it is assumed to be raw header data with 317 * numeric keys with the headers as the values. No headers must be passed 318 * that were already processed. 321 319 * 322 * Checking could be added, but it is easier and faster to just passed the323 * array through and assume that it has already been processed.324 *325 320 * @access public 326 321 * @static 327 322 * @since 2.7 … … 330 325 * @return array Processed string headers 331 326 */ 332 327 function processHeaders($headers) { 333 if ( is_ array($headers) )334 return $headers;328 if ( is_string($headers) ) 329 $headers = explode("\n", str_replace(array("\r\n", "\r"), "\n", $headers) ); 335 330 336 $headers = explode("\n", str_replace(array("\r\n", "\r"), "\n", $headers) );337 338 331 $response = array('code' => 0, 'message' => ''); 339 332 340 333 $newheaders = array(); … … 342 335 if ( empty($tempheader) ) 343 336 continue; 344 337 338 345 339 if ( false === strpos($tempheader, ':') ) { 346 340 list( , $iResponseCode, $strResponseMsg) = explode(' ', $tempheader, 3); 347 341 $response['code'] = $iResponseCode; … … 560 554 } else { 561 555 $theHeaders = $http_response_header; 562 556 } 563 $processedHeaders = WP_Http::processHeaders($theHeaders);564 557 565 558 fclose($handle); 559 560 $processedHeaders = WP_Http::processHeaders($theHeaders); 561 566 562 return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response']); 567 563 } 568 564 … … 762 758 $theHeaders = WP_Http::processHeaders($theHeaders); 763 759 764 760 $theResponse = array(); 765 $theResponse[' response']['code'] = $info['response_code'];766 $theResponse[' response']['message'] = get_status_header_desc($info['response_code']);761 $theResponse['code'] = $info['response_code']; 762 $theResponse['message'] = get_status_header_desc($info['response_code']); 767 763 768 764 return array('headers' => $theHeaders['headers'], 'body' => $theBody, 'response' => $theResponse); 769 765 }