Ticket #4779: 4779.r8521.diff
File 4779.r8521.diff, 2.2 KB (added by , 16 years ago) |
---|
-
http.php
536 536 if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] ) 537 537 $url = str_replace($arrURL['scheme'], 'http', $url); 538 538 539 $handle = fopen($url, 'r b');539 $handle = fopen($url, 'r'); 540 540 541 541 if (! $handle) 542 542 return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url)); … … 553 553 while ( ! feof($handle) ) 554 554 $strResponse .= fread($handle, 4096); 555 555 556 fclose($handle);557 558 556 $theHeaders = ''; 559 557 if ( function_exists('stream_get_meta_data') ) { 560 558 $meta = stream_get_meta_data($handle); … … 564 562 } 565 563 $processedHeaders = WP_Http::processHeaders($theHeaders); 566 564 565 fclose($handle); 567 566 return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response']); 568 567 } 569 568 … … 635 634 636 635 $context = stream_context_create($arrContext); 637 636 638 $handle = fopen($url, 'r b', false, $context);637 $handle = fopen($url, 'r', false, $context); 639 638 640 stream_set_timeout($handle, apply_filters('http_request_stream_timeout', $ this->timeout) );639 stream_set_timeout($handle, apply_filters('http_request_stream_timeout', $r['timeout']) ); 641 640 642 641 if ( ! $handle) 643 642 return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url)); … … 747 746 'timeout' => $r['timeout'], 748 747 'connecttimeout' => $r['timeout'], 749 748 'redirect' => $r['redirection'], 750 'useragent' => $r['user _agent'],749 'useragent' => $r['user-agent'], 751 750 'headers' => $headers, 752 751 ); 753 752 … … 849 848 curl_setopt( $handle, CURLOPT_HTTPHEADER, $headers ); 850 849 851 850 if ( $r['httpversion'] == '1.0' ) 852 curl_setopt( $h eadle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );851 curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 ); 853 852 else 854 curl_setopt( $h eadle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );853 curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); 855 854 856 855 if ( ! $r['blocking'] ) { 857 856 curl_close( $handle ); … … 1084 1083 return $response['body']; 1085 1084 } 1086 1085 1087 ?> 1086 ?> 1087 No newline at end of file