@Findus23 opened this Issue on April 13th 2018 Member

After long debugging of an issue where no update was found, it turned out that a proxy was blocking the request.
https://forum.matomo.org/t/update-from-3-3-0-to-3-4-0-not-offered-in-matomo/27786

In my opinion the updater should not act as if no update is available if the request fails.

On the contrary always showing warnings may be annoying in case api.matomo.org is down once. Maybe a warning could only be shown after repeated retries.

@fdellwing commented on April 16th 2018 Contributor

The Http::sendHttpRequest() function already handles http errors and returns false. So there needs to be some other problem. Maybe squid does not correctly answer with http status 403?

To prevent this issue on Matomo site, a new function should be added to core/Http.php like this:

public static function sendHttpRequestWithExpectedResult($aUrl,
                                           $expectedPattern,
                                           $timeout,
                                           $userAgent = null,
                                           $destinationPath = null,
                                           $followDepth = 0,
                                           $acceptLanguage = false,
                                           $byteRange = false,
                                           $getExtendedInfo = false,
                                           $httpMethod = 'GET', 
                                           $httpUsername = null,
                                           $httpPassword = null)
    {
        // Do the same as in sendHttpRequest but do a preg_match() against the body afterwards.
    }

If you like this solution I'll provide a PR for that.

@fdellwing commented on April 23rd 2018 Contributor

Any opinions?

Powered by GitHub Issue Mirror