From 6a4aa34b0c618a804bf108049e95caf6028c84bd Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Wed, 3 Feb 2016 00:34:49 +0100 Subject: [PATCH] Don't process further in redirection if HEAD gives 400 Bad request --- classes/File_redirection.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/File_redirection.php b/classes/File_redirection.php index 9b872f3556..e901c464d7 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -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 +} -- 2.39.5