Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -273,61 +273,12 @@ |
274 | 274 | $this->proxy = 'http://localhost:80/'; |
275 | 275 | } elseif ( $wgHTTPProxy ) { |
276 | 276 | $this->proxy = $wgHTTPProxy ; |
277 | | - } elseif ( $this->useProxy( $this->url ) ) { |
278 | | - $this->proxy = $this->useProxy( $this->url ); |
| 277 | + } elseif ( getenv( "http_proxy" ) ) { |
| 278 | + $this->proxy = getenv( "http_proxy" ); |
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
282 | 282 | /** |
283 | | - * Determine HTTP proxy from environment settings respecting |
284 | | - * 'http_proxy' and 'no_proxy' environment variables |
285 | | - */ |
286 | | - public static function useProxy( $url ) { |
287 | | - if ( $proxy = getenv( "http_proxy" ) ) { |
288 | | - $useproxy = true; |
289 | | - if ( $url && ( $noproxy = preg_split( "#\s*,\s*#is", getenv( "no_proxy" ) ) ) ) { |
290 | | - foreach ( $noproxy as $n ) { |
291 | | - if ( preg_match('#(\d+)\.(\d+)\.(\d+)\.(\d+)/(\d+)#s', $n, $m) && |
292 | | - preg_match('#^[a-z0-9_]+://(?:[^/]*:[^/]*@)?([^/@]+)(?:/|$|\?)#is', $url, $ip) ) { |
293 | | - $mask = array( |
294 | | - max( 0x100 - ( 1 << max( 8-$m[5], 0 ) ), 0 ), |
295 | | - max( 0x100 - ( 1 << max( 16-$m[5], 0 ) ), 0 ), |
296 | | - max( 0x100 - ( 1 << max( 24-$m[5], 0 ) ), 0 ), |
297 | | - max( 0x100 - ( 1 << max( 32-$m[5], 0 ) ), 0 ), |
298 | | - ); |
299 | | - $ip = @gethostbyname( $ip[1] ); |
300 | | - if ( preg_match( '#(\d+)\.(\d+)\.(\d+)\.(\d+)#s', $ip, $ipm ) && |
301 | | - ( intval( $ipm[1] ) & $mask[0] ) == intval( $m[1] ) && |
302 | | - ( intval( $ipm[2] ) & $mask[1] ) == intval( $m[2] ) && |
303 | | - ( intval( $ipm[3] ) & $mask[2] ) == intval( $m[3] ) && |
304 | | - ( intval( $ipm[4] ) & $mask[3] ) == intval( $m[4] ) ) { |
305 | | - $useproxy = false; |
306 | | - break; |
307 | | - } |
308 | | - } else { |
309 | | - $n = preg_replace( '/#.*$/is', '', $n ); |
310 | | - $n = preg_quote( $n ); |
311 | | - $n = str_replace( '\\*', '.*', $n ); |
312 | | - if ( preg_match( '#'.$n.'#is', $url ) ) { |
313 | | - $useproxy = false; |
314 | | - break; |
315 | | - } |
316 | | - } |
317 | | - } |
318 | | - } |
319 | | - if ( $useproxy ) { |
320 | | - $proxy = preg_replace( '#^http://#is', '', $proxy ); |
321 | | - $proxy = preg_replace( '#/*$#is', '', $proxy ); |
322 | | - } |
323 | | - else { |
324 | | - $proxy = null; |
325 | | - } |
326 | | - return $proxy; |
327 | | - } |
328 | | - return null; |
329 | | - } |
330 | | - |
331 | | - /** |
332 | 283 | * Set the refererer header |
333 | 284 | */ |
334 | 285 | public function setReferer( $url ) { |