From: Brion Vibber Date: Sat, 21 Mar 2009 00:01:44 +0000 (+0000) Subject: HTTP proxy usage tweaks: X-Git-Tag: 1.31.0-rc.0~42424 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=1c128f831daf6b0cbe28e89c04917ecf6e4de8a0;p=lhc%2Fweb%2Fwiklou.git HTTP proxy usage tweaks: * Use $wgHTTPProxy if set for Special:Upload upload-by-URL (it does its own CURL fetch instead of using Http class) * Explicitly disable HTTP proxy for MWSearch fetches -- we know that'll be local network. --- diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 8849b552ed..7d28a38c3d 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -155,7 +155,7 @@ class UploadForm { * Returns true if there was an error, false otherwise */ private function curlCopy( $url, $dest ) { - global $wgUser, $wgOut; + global $wgUser, $wgOut, $wgHTTPProxy; if( !$wgUser->isAllowed( 'upload_by_url' ) ) { $wgOut->permissionRequired( 'upload_by_url' ); @@ -183,6 +183,9 @@ class UploadForm { curl_setopt( $ch, CURLOPT_TIMEOUT, 10); # 10 seconds timeout curl_setopt( $ch, CURLOPT_LOW_SPEED_LIMIT, 512); # 0.5KB per second minimum transfer speed curl_setopt( $ch, CURLOPT_URL, $url); + if( $wgHTTPProxy ) { + curl_setopt( $ch, CURLOPT_PROXY, $wgHTTPProxy ); + } curl_setopt( $ch, CURLOPT_WRITEFUNCTION, array( $this, 'uploadCurlCallback' ) ); curl_exec( $ch ); $error = curl_errno( $ch ) ? true : false;