[BUGFIX] Linkvalidator: Improve tolerance on HEAD-request error 25/35025/2
authorStefan Weißwange <stefan.weisswange@tsa.de>
Sat, 8 Nov 2014 18:28:59 +0000 (19:28 +0100)
committerMarkus Klein <klein.t3@reelworx.at>
Thu, 4 Dec 2014 10:20:36 +0000 (11:20 +0100)
Force second URL-request if first response had an HTTP-status-code
which indicates a client-error (4xx) or a server-error (5xx).

Resolves: #58145
Releases: master, 6.2
Change-Id: I5cb02a6345494ffbe23caba652628b91812aea37
Reviewed-on: http://review.typo3.org/35025
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php

index 8596828..623fb2c 100644 (file)
@@ -74,9 +74,9 @@ class ExternalLinktype extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktyp
                try {
                        /** @var $response \HTTP_Request2_Response */
                        $response = $request->send();
-                       // HEAD was not allowed, now trying GET
                        $status = isset($response) ? $response->getStatus() : 0;
-                       if ($status === 405 || $status === 403) {
+                       // HEAD was not allowed or threw an error, now trying GET
+                       if ($status >= 400) {
                                $request->setMethod('GET');
                                $request->setHeader('Range', 'bytes = 0 - 4048');
                                /** @var $response \HTTP_Request2_Response */