Changeset 13149
- Timestamp:
- 02/14/2010 10:41:07 AM (16 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/http.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/http.php
r12785 r13149 749 749 750 750 // If location is found, then assume redirect and redirect to location. 751 if ( isset($arrHeaders['headers']['location']) ) {751 if ( 'HEAD' != $r['method'] && isset($arrHeaders['headers']['location']) ) { 752 752 if ( $r['redirection']-- > 0 ) { 753 753 return $this->request($arrHeaders['headers']['location'], $r); … … 916 916 return false; 917 917 918 if ( isset($args['method']) && 'HEAD' == $args['method'] ) //This transport cannot make a HEAD request 919 return false; 920 918 921 $use = true; 919 920 922 //PHP does not verify SSL certs, We can only make a request via this transports if SSL Verification is turned off. 921 923 $is_ssl = isset($args['ssl']) && $args['ssl']; … … 1011 1013 'protocol_version' => (float) $r['httpversion'], 1012 1014 'header' => $strHeaders, 1015 'ignore_errors' => true, // Return non-200 requests. 1013 1016 'timeout' => $r['timeout'], 1014 1017 'ssl' => array( … … 1030 1033 } 1031 1034 1032 if ( ! is_null($r['body']) && ! empty($r['body'] ) ) 1035 if ( 'HEAD' == $r['method'] ) // Disable redirects for HEAD requests 1036 $arrContext['http']['max_redirects'] = 1; 1037 1038 if ( ! empty($r['body'] ) ) 1033 1039 $arrContext['http']['content'] = $r['body']; 1034 1040 … … 1040 1046 $handle = fopen($url, 'r', false, $context); 1041 1047 1042 if ( ! $handle )1048 if ( ! $handle ) 1043 1049 return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $url)); 1044 1050 … … 1191 1197 ); 1192 1198 1199 if ( HTTP_METH_HEAD == $r['method'] ) 1200 $options['redirect'] = 0; // Assumption: Docs seem to suggest that this means do not follow. Untested. 1201 1193 1202 // The HTTP extensions offers really easy proxy support. 1194 1203 $proxy = new WP_HTTP_Proxy(); … … 1359 1368 1360 1369 // The option doesn't work with safe mode or when open_basedir is set. 1361 if ( !ini_get('safe_mode') && !ini_get('open_basedir') ) 1370 // Disable HEAD when making HEAD requests. 1371 if ( !ini_get('safe_mode') && !ini_get('open_basedir') && 'HEAD' != $r['method'] ) 1362 1372 curl_setopt( $handle, CURLOPT_FOLLOWLOCATION, true ); 1363 1373
Note: See TracChangeset
for help on using the changeset viewer.