Changes between Version 3 and Version 4 of howto/AvoidRedirects
- Timestamp:
- Aug 6, 2013, 9:43:50 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
howto/AvoidRedirects
v3 v4 1 1 [wiki:howto <- Back to the HOWTO section] 2 2 3 = How to build Avoid master_sites Redirects =3 = How to avoid master_sites redirects = 4 4 5 5 * Audience: Portfile authors … … 8 8 == Introduction == 9 9 10 In order to be a good 'Net citizen, it is worthwhile to minimize the load on other's servers. One simple technique is to specify the `master_sites` parameter as specifically as possible so that the other side does not have to supply redirects in order to serve the file we want. This how-to currently addresses only SourceForge. 10 `master_sites` should usually be specified in such a way that HTTP redirects are avoided. 11 This not only reduces network traffic and server load but also lets the user start their download more quickly. 12 This how-to currently addresses only SourceForge but similar techniques can be used for any other site. 11 13 12 14 == SourceForge == 15 16 In addition to the aforementioned general reasons for avoiding redirects, it's especially important for files hosted at SourceForge. 17 For all ports, MacPorts tries to download from a server near to the user (measured by ping time). 18 SourceForge has a network of mirror servers, of which MacPorts maintains [browser:trunk/dports/_resources/port1.0/fetch/mirror_sites.tcl a list]. 19 But if the server MacPorts has chosen to use issues a redirect, it might redirect to a different server which might have a worse ping time, which we want to avoid. 13 20 14 21 Hopefully, the following example, using mediainfo version 0.7.60, will illuminate the process. The SourceForge home page for mediainfo is [[http://mediainfo.sourceforge.net]]. Initially, just specifying `'sourceforge'` in the portfile under development worked to retrieve the distfile. … … 38 45 }}} 39 46 47 In the event that the URL had included "0.7" (and not "0.7.60") you would want to define and employ [PortfileRecipes#branch the ${branch} variable] instead of ${version}. 48 40 49 Pat yourself on the back--you're done! 41 50