Download of GeoIP data fails because of leading space in URL


#1

On my system the update of the GeoLityCity database failed with the following message:
INFO [2014-07-26 15:43:12] [4f48f] Error: GeoIPAutoUpdater: failed to download ’ http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz’ to ‘/var/www/vhosts/piwik.mherbst.de/misc/GeoIPCity.dat.dat.gz’: curl_exec: Protocol http not supported or disabled in libcurl. Hostname requested was: http
Error: GeoIPAutoUpdater: failed to download ’ http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz’ to ‘/var/www/vhosts/piwik.mherbst.de/misc/GeoIPCity.dat.dat.gz’: curl_exec: Protocol http not supported or disabled in libcurl. Hostname requested was: http
task,output
Piwik\Plugins\UserCountry\GeoIPAutoUpdater.update,ERROR: GeoIPAutoUpdater: failed to download ’ http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz’ to ‘/var/www/vhosts/piwik.mherbst.de/misc/GeoIPCity.dat.dat.gz’: curl_exec: Protocol http not supported or disabled in libcurl. Hostname requested was: http

If you look closely at the error message you can see the it complains about protocol " http". After some research I found that there is really a space character in the URL before “http”. To fix the problem I edited the script GeoIPAutoUpdater.php and added a call to trim in line 138:
$url = trim(self::removeDateFromUrl($url));

now it works again.


(Matthieu Aubry) #2

Thanks for the suggestion! this was fixed in Trim URL before attempting to download it · matomo-org/matomo@9e6329b · GitHub