[BUGFIX] Linkvalidator: Improve tolerance on HEAD-request error 09/33909/3
authorStefan Weißwange <stefan.weisswange@tsa.de>
Sat, 8 Nov 2014 18:28:59 +0000 (19:28 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 9 Nov 2014 00:15:30 +0000 (01:15 +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/33909
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/linkvalidator/Classes/Linktype/ExternalLinktype.php

index f36894e..fc2ca08 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 */