Index: trunk/extensions/VipsScaler/SpecialVipsTest.php |
— | — | @@ -362,8 +362,21 @@ |
363 | 363 | $url = wfAppendQuery( $url, array( 'noproxy' => '1' ) ); |
364 | 364 | wfDebug( __METHOD__ . ": Getting vips thumb from remote url $url\n" ); |
365 | 365 | |
366 | | - $options = array( 'method' => 'GET' ); |
| 366 | + $bits = IP::splitHostAndPort( $wgVipsThumbnailerHost ); |
| 367 | + if ( !$bits ) { |
| 368 | + throw new MWException( __METHOD__.': $wgVipsThumbnailerHost is not set to a valid host' ); |
| 369 | + } |
| 370 | + list( $host, $port ) = $bits; |
| 371 | + if ( $port === false ) { |
| 372 | + $port = 80; |
| 373 | + } |
| 374 | + $proxy = IP::combineHostAndPort( $host, $port ); |
367 | 375 | |
| 376 | + $options = array( |
| 377 | + 'method' => 'GET', |
| 378 | + 'proxy' => $proxy, |
| 379 | + ); |
| 380 | + |
368 | 381 | $req = MWHttpRequest::factory( $url, $options ); |
369 | 382 | $status = $req->execute(); |
370 | 383 | if ( $status->isOk() ) { |
— | — | @@ -375,10 +388,12 @@ |
376 | 389 | header( "Cache-Control: public, max-age=$wgVipsTestExpiry, s-maxage=$wgVipsTestExpiry" ); |
377 | 390 | header( 'Expires: ' . gmdate( 'r ', time() + $wgVipsTestExpiry ) ); |
378 | 391 | print $req->getContent(); |
| 392 | + } elseif ( $status->hasMessage( 'http-bad-status' ) ) { |
| 393 | + return $this->streamError( 500, $req->getContent() ); |
379 | 394 | } else { |
380 | | - return $this->streamError( 500, $req->getContent() ); |
| 395 | + global $wgOut; |
| 396 | + return $this->streamError( 500, $wgOut->parse( $status->getWikiText() ) ); |
381 | 397 | } |
382 | | - |
383 | 398 | } |
384 | 399 | } |
385 | 400 | |
Index: trunk/extensions/VipsScaler/VipsScaler_body.php |
— | — | @@ -400,9 +400,13 @@ |
401 | 401 | */ |
402 | 402 | public function execute() { |
403 | 403 | # Build and escape the command string |
404 | | - $cmd = wfEscapeShellArg( $this->vips, |
405 | | - array_shift( $this->args ), |
406 | | - $this->input, $this->output ); |
| 404 | + $cmd = |
| 405 | + 'IM_CONCURRENCY=1 ' . |
| 406 | + wfEscapeShellArg( |
| 407 | + $this->vips, |
| 408 | + array_shift( $this->args ), |
| 409 | + $this->input, $this->output |
| 410 | + ); |
407 | 411 | |
408 | 412 | foreach ( $this->args as $arg ) { |
409 | 413 | $cmd .= ' ' . wfEscapeShellArg( $arg ); |