Project

General

Profile

Actions

Bug #40486

closed

HTTP Redirecs mark links as defect

Added by Benjamin Albrecht about 12 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Linkvalidator
Target version:
-
Start date:
2012-08-31
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.5
PHP Version:
5.3
Tags:
Complexity:
no-brainer
Is Regression:
Sprint Focus:

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);
}
Actions #1

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.

Actions #2

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.

Actions #3

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 :-)

Actions #4

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

Actions #5

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.

Actions #6

Updated by Anonymous about 12 years ago

  • Status changed from Under Review to Resolved

Applied in changeset commit:203bad7b1b9171ff68085906fa79584d15b61fed.

Actions #7

Updated by Michael Stucki almost 11 years ago

  • Category set to Linkvalidator
Actions #8

Updated by Michael Stucki almost 11 years ago

  • Project changed from 1510 to TYPO3 Core
  • Category changed from Linkvalidator to Linkvalidator
Actions #9

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF