Bug #40486
closedHTTP Redirecs mark links as defect
100%
Description
The following code (ExternalLinktype.php) marks all redirected links as defect or "not valid".
IMO only HTTP status 400 and above should mark links as defect.
Many websites response with a HTTP redirect at the startpage (http://www.example.org > http://www.example.org/de-DE/)
I think, this is ok and shouldn't mark the link as corrupt.
A backwards compatible solution could be to implement a TypoScript configure option...
if (isset($response) && $response->getStatus() >= 300) { $isValidUrl = FALSE; $errorParams['errorType'] = $response->getStatus(); $errorParams['message'] = $response->getReasonPhrase(); } if (!$isValidUrl) { $this->setErrorParams($errorParams); }
Updated by Benjamin Albrecht about 12 years ago
Here is another real world example:
An editor uses this correct URL as a link: http://get.adobe.com/de/reader
The Browser gets one redirect (http://get.adobe.com/de/reader/)
If I use curl at the command line I get tow redirects:
1. http://get.adobe.com/de/reader/
2. http://get.adobe.com/de/reader/otherversions/
This behavior shouldn't mark the link as defect.
Updated by Daniel Minder about 12 years ago
- Status changed from New to Needs Feedback
The redirect handling is completely done by HttpRequest (follow_redirects set to TRUE in the config array). HttpRequest relies on PEAR's HTTP_Request2, which is delivered with Typo3. But do you have an older (<0.5.0) PEAR installed locally? Check the phpinfo output.
Updated by Benjamin Albrecht about 12 years ago
Oh, sorry!
My reported TYPO3 Version was wrong :-/
The TYPO3 Version of my Testcase is 4.5.19
The posted sourcecode comes from 6.0beta1 an of course the redirect handling of HttpRequest works fine.
It seems, that the "redirect check behavior" was changed with 4.6
One more reason to upgrade my 4.5 installation :-)
Updated by Gerrit Code Review about 12 years ago
- Status changed from Needs Feedback to Under Review
Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/14253
Updated by Daniel Minder about 12 years ago
- Assignee set to Daniel Minder
- % Done changed from 0 to 100
- TYPO3 Version changed from 6.0 to 4.5
- Complexity set to no-brainer
The redirect handling is done manually in 4.5.19. But I checked the http://get.adobe.com/de/reader link and figured out that the server responds with a "location:" line - note the lower-case "l". According to RFC 2616 the field names are case insensitive but this was not observed by linkvalidator. With a small patch the link is not marked as defect any more.
BTW: If the server responds with a 301/302/303/307 but the header does not contain a location line linkvalidator keeps querying the server until the retry count is reached. I'm not sure if we should break sooner in this case. However, I guess that this does not happen very often.
Updated by Anonymous about 12 years ago
- Status changed from Under Review to Resolved
Applied in changeset commit:203bad7b1b9171ff68085906fa79584d15b61fed.
Updated by Michael Stucki almost 11 years ago
- Project changed from 1510 to TYPO3 Core
- Category changed from Linkvalidator to Linkvalidator