Module: tools Branch: master Commit: c97e300fa50540af4c9b9cea5d17293524320cbd URL: http://source.winehq.org/git/tools.git/?a=commit;h=c97e300fa50540af4c9b9cea5...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Feb 27 11:45:49 2015 +0100
winegecko.php: Make use of autoselect mirror SourceForge feature.
This leaves the job of redirecting to mirror to SourceForge, which may do much better job at this than we do. Our current solution is to redirect to random mirror known to have Gecko. In our current code, connection time is bad (it may even feel like it hangs), because we need an additional request from server script to a mirror to ensure that the resource is present there. Also, choosing random mirror often causes pretty bad transfers.
---
winegecko.php | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/winegecko.php b/winegecko.php index fdc1b96..e44b9e3 100644 --- a/winegecko.php +++ b/winegecko.php @@ -48,6 +48,16 @@ default: // Name of the file $sFileName = sprintf('%s/%s/wine_gecko-%s.%s', $sFolder, $sVersion, $sFileSuffix, $sExt);
+// SourceForge can do better job at redirecting to the mirror than us. However, +// it redirects to HTML page by default for web browser user agents. New enough +// Wine set user agent to 'Wine Addon Downloader', so redirect them directly +// to SourceForge. For older Wine and other user agents, fallback to random +// known mirror. +if(strcmp($_SERVER['HTTP_USER_AGENT'], 'Wine Addon Downloader') === 0) { + header("Location: http://sourceforge.net/projects/wine/files/%22.$sFileName); + exit; +} + // Size array $aFileSizes = array( '0.0.1'=>5219822,