]> BookStack Code Mirror - bookstack/blobdiff - app/Uploads/HttpFetcher.php
Fixed OIDC Logout
[bookstack] / app / Uploads / HttpFetcher.php
index 5e8115637dbbe23abf78dd5a9eb52959d9e75fe8..fcb4147e9ee65e6b369d947cf706aeac2c438d99 100644 (file)
@@ -1,23 +1,27 @@
-<?php namespace BookStack\Uploads;
+<?php
+
+namespace BookStack\Uploads;
 
 use BookStack\Exceptions\HttpFetchException;
 
 class HttpFetcher
 {
-
     /**
      * Fetch content from an external URI.
+     *
      * @param string $uri
-     * @return bool|string
+     *
      * @throws HttpFetchException
+     *
+     * @return bool|string
      */
     public function fetch(string $uri)
     {
         $ch = curl_init();
         curl_setopt_array($ch, [
-            CURLOPT_URL => $uri,
+            CURLOPT_URL            => $uri,
             CURLOPT_RETURNTRANSFER => 1,
-            CURLOPT_CONNECTTIMEOUT => 5
+            CURLOPT_CONNECTTIMEOUT => 5,
         ]);
 
         $data = curl_exec($ch);
@@ -25,7 +29,8 @@ class HttpFetcher
         curl_close($ch);
 
         if ($err) {
-            throw new HttpFetchException($err);
+            $errno = curl_errno($ch);
+            throw new HttpFetchException($err, $errno);
         }
 
         return $data;