Skip to content

Wrong URL resolution on redirects #93

Description

@kelunik

The URL resolution is broken if there are any redirects and non-absolute URLs involved. The problematic code is in Crawler. It uses the original document URL instead of the URL of the latest request, which might be different from the original URL due to redirects.

Possible Solution

$this->enqueueLinks($this->loadXpath($body), Url::fromUrl((string)$response->getRequest()->getUri()), $report, $queue);

Reproduction Case

Crawl https://amphp.org/. I don't see any failures with -x0 and that fix, without the fix there are 3 errors which are false positives.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions