Ticket #37456: 37456.2.diff
File 37456.2.diff, 1.9 KB (added by , 9 years ago) |
---|
-
src/wp-includes/class-http.php
class WP_Http { 303 303 $options = array( 304 304 'timeout' => $r['timeout'], 305 305 'useragent' => $r['user-agent'], 306 306 'blocking' => $r['blocking'], 307 307 'hooks' => new Requests_Hooks(), 308 308 ); 309 309 310 310 // Ensure redirects follow browser behaviour. 311 311 $options['hooks']->register( 'requests.before_redirect', array( get_class(), 'browser_redirect_compatibility' ) ); 312 312 313 313 if ( $r['stream'] ) { 314 314 $options['filename'] = $r['filename']; 315 315 } 316 316 if ( empty( $r['redirection'] ) ) { 317 317 $options['follow_redirects'] = false; 318 } 319 else { 318 } else { 320 319 $options['redirects'] = $r['redirection']; 321 320 } 322 321 323 322 // Use byte limit, if we can 324 323 if ( isset( $r['limit_response_size'] ) ) { 325 324 $options['max_bytes'] = $r['limit_response_size']; 326 325 } 327 326 328 327 // If we've got cookies, use them 329 328 if ( ! empty( $r['cookies'] ) ) { 330 329 $options['cookies'] = $r['cookies']; 331 330 } 332 331 333 332 // SSL certificate handling 334 333 if ( ! $r['sslverify'] ) { 335 334 $options['verify'] = false; 336 } 337 else { 335 } else { 338 336 $options['verify'] = $r['sslcertificates']; 339 337 } 340 338 339 // All non-GET/HEAD requests should put the args in the form body 340 if ( 'HEAD' != $type && 'GET' != $type ) { 341 $options['data_format'] = 'body'; 342 } 343 341 344 /** 342 345 * Filters whether SSL should be verified for non-local requests. 343 346 * 344 347 * @since 2.8.0 345 348 * 346 349 * @param bool $ssl_verify Whether to verify the SSL connection. Default true. 347 350 */ 348 351 $options['verify'] = apply_filters( 'https_ssl_verify', $options['verify'] ); 349 352 350 353 // Check for proxies. 351 354 $proxy = new WP_HTTP_Proxy(); 352 355 if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { 353 356 $options['proxy'] = new Requests_Proxy_HTTP( $proxy->host() . ':' . $proxy->port() ); 354 357 355 358 if ( $proxy->use_authentication() ) {