I am currently setting up a test-instance for my workshop and I try to be pedantic and not skip over potential bugs when doing so.
Currently I am really confused by the GeoIP downloader (I think I saw the same bug for the initial download on my real instance, but the updater works):
When I try to initially download the free geoip2 database, I just get the generic
print_r($expectedFileSizeResult); shows the source of the issue:
Array ( [status] => 200 [headers] => Array ( [date] => Thu, 11 Apr 2019 16:29:34 GMT [content-type] => application/gzip [content-length] => 29444833 [set-cookie] => __cfduid=d5e7c2e5b339a937a45385e60f1a69d7c1555000174; expires=Fri, 10-Apr-20 16:29:34 GMT; path=/; domain=.geolite.maxmind.com; HttpOnly [content-disposition] => attachment; filename=GeoLite2-City_20190409.tar.gz [last-modified] => Mon, 08 Apr 2019 12:07:23 GMT [cf-cache-status] => HIT [expires] => Thu, 11 Apr 2019 20:29:34 GMT [cache-control] => public, max-age=14400 [accept-ranges] => bytes [expect-ct] => max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" [server] => cloudflare [cf-ray] => 4c5e57111a0dbef8-FRA ) [data] => )
Cloudflare only returns lowercase HTTP headers, but Matomo only checks for
'Content-Length' and therefore the download fails.
Interestingly fixing this, the download still doesn't work as I just get an unhelpful
Failed sending HTTP request here:
I'm also a bit clueless why I am the first one to come across this issue. Am I missing something?
I think I have found the potential answer to why I am the only one to report this bug:
I am using a fairly modern curl version (7.64.0 in the php module) and for a while curl now uses HTTP/2 by default.
curl -v --http1.0 https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz cloudflare responds with uppercase headers.
That also explains why the download still fails as many parts of Http.php have been written without newer HTTP versions in mind like e.g.
Moving it to 3.12 as it might be a somewhat easy fix (but will take a while to get new curl version installed) and could affect eventually quite a few people