@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?

@tsteur commented on May 29th 2018 Member

Maybe we could add a system check for it? To test we receive a version number?

@Findus23 commented on May 29th 2018 Member

@tsteur That won't help people who have a proxy blocking the request without their knowledge.

@tsteur commented on May 29th 2018 Member

Sorry not sure I get it. I read the forum post... as we probably don't really want to fail during run time when that request fails, it may be better to show it in a system check (which is also shown on Admin Home) that something is wrong / not working?

@Findus23 commented on May 29th 2018 Member

Ah, sorry my mistake. A system check is a great idea. (I read system test, which wouldn't make any sense)

@fdellwing commented on May 30th 2018 Contributor

:+1:

That check should also allow to see the returned error message if there is one.

Powered by GitHub Issue Mirror