Changeset 10320
- Timestamp:
- 01/06/2009 05:29:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/http.php
r10309 r10320 258 258 259 259 if ( is_null($r['body']) ) { 260 // Some servers fail when sending content without the content-length 261 // header being set. 260 262 $r['headers']['Content-Length'] = 0; 261 263 $transports = WP_Http::_getTransport($r); … … 661 663 return new WP_Error('http_request_failed', sprintf(__('Malformed URL: %s'), $url)); 662 664 663 if ( 'http' != $arrURL['scheme'] ||'https' != $arrURL['scheme'] )665 if ( 'http' != $arrURL['scheme'] && 'https' != $arrURL['scheme'] ) 664 666 $url = str_replace($arrURL['scheme'], 'http', $url); 665 667 … … 795 797 $context = stream_context_create($arrContext); 796 798 797 if ( ! defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )799 if ( ! defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) ) 798 800 $handle = @fopen($url, 'r', false, $context); 799 801 else … … 1000 1002 } 1001 1003 1002 // If timeout is a float less than 1, round it up to 1. 1004 // cURL extension will sometimes fail when the timeout is less than 1 as 1005 // it may round down to 0, which gives it unlimited timeout. 1003 1006 if ( $r['timeout'] > 0 && $r['timeout'] < 1 ) 1004 1007 $r['timeout'] = 1; … … 1007 1010 curl_setopt( $handle, CURLOPT_URL, $url); 1008 1011 1012 // The cURL extension requires that the option be set for the HEAD to 1013 // work properly. 1009 1014 if ( 'HEAD' === $r['method'] ) { 1010 1015 curl_setopt( $handle, CURLOPT_NOBODY, true ); … … 1025 1030 curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] ); 1026 1031 1032 // The option doesn't work with safe mode or when open_basedir is set. 1027 1033 if ( !ini_get('safe_mode') && !ini_get('open_basedir') ) 1028 1034 curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true ); … … 1036 1042 curl_setopt( $handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 ); 1037 1043 1044 // Cookies are not handled by the HTTP API currently. Allow for plugin 1045 // authors to handle it themselves... Although, it is somewhat pointless 1046 // without some reference. 1038 1047 do_action_ref_array( 'http_api_curl', array(&$handle) ); 1039 1048 1049 // We don't need to return the body, so don't. Just execution request 1050 // and return. 1040 1051 if ( ! $r['blocking'] ) { 1041 1052 curl_exec( $handle );
Note: See TracChangeset
for help on using the changeset viewer.