]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Don't process further in redirection if HEAD gives 400 Bad request
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 2 Feb 2016 23:34:49 +0000 (00:34 +0100)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 2 Feb 2016 23:34:49 +0000 (00:34 +0100)
classes/File_redirection.php

index 9b872f3556e378ab66f9fdcec17a75e582baed45..e901c464d745b5cd3d48f7b2432499fc754f6cc1 100644 (file)
@@ -120,6 +120,8 @@ class File_redirection extends Managed_DataObject
                 // no content it'll be cheap. :)
                 $request = self::_commonHttp($short_url, $redirs);
                 $response = $request->send();
+            } elseif (400 == $response->getStatus()) {
+                throw new Exception('Got error 400 on HEAD request, will not go further.');
             }
         } catch (Exception $e) {
             // Invalid URL or failure to reach server
@@ -418,4 +420,4 @@ class File_redirection extends Managed_DataObject
 
         return $this->file;
     }
-}
\ No newline at end of file
+}