X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FForeignResourceManager.php;h=18014fa528039dc1900a2eb4515c2ff4a69247c5;hb=80da67d69f237ceb26a5768818644b5a459d2f37;hp=d6175f6dbab720c137d15e86bcb2a6cca5690fd7;hpb=0770f85a0a293e6c7af6f1d3d3a1dbd2d13c1e09;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ForeignResourceManager.php b/includes/ForeignResourceManager.php index d6175f6dba..18014fa528 100644 --- a/includes/ForeignResourceManager.php +++ b/includes/ForeignResourceManager.php @@ -132,10 +132,14 @@ class ForeignResourceManager { } private function fetch( $src, $integrity ) { - $data = Http::get( $src, [ 'followRedirects' => false ] ); - if ( $data === false ) { + $req = MWHttpRequest::factory( $src, [ 'method' => 'GET', 'followRedirects' => false ] ); + if ( !$req->execute()->isOK() ) { throw new Exception( "Failed to download resource at {$src}" ); } + if ( $req->getStatus() !== 200 ) { + throw new Exception( "Unexpected HTTP {$req->getStatus()} response from {$src}" ); + } + $data = $req->getContent(); $algo = $integrity === null ? $this->defaultAlgo : explode( '-', $integrity )[0]; $actualIntegrity = $algo . '-' . base64_encode( hash( $algo, $data, true ) ); if ( $integrity === $actualIntegrity ) {