Author: poeml Date: Wed Feb 10 03:03:35 2010 New Revision: 7948 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=7948&view=rev Log: mod_mirrorbrain: - wrongly inserted URL types (HTTP instead of FTP) have been fixed, which occurred in Metalinks for FTP URLs). This fixes issue 23. Modified: trunk/mod_mirrorbrain/mod_mirrorbrain.c Modified: trunk/mod_mirrorbrain/mod_mirrorbrain.c URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mod_mirrorbrain/mod_mirrorbrain.c?rev=7948&r1=7947&r2=7948&view=diff ============================================================================== --- trunk/mod_mirrorbrain/mod_mirrorbrain.c (original) +++ trunk/mod_mirrorbrain/mod_mirrorbrain.c Wed Feb 10 03:03:35 2010 @@ -650,6 +650,18 @@ return m1->rank - m2->rank; } +/* return the scheme of an URL, e.g. ftp for ftp://foo.example.com/ */ +static const char *url_scheme(apr_pool_t *p, const char *url) +{ + const char *s; + s = apr_pstrndup(p, url, strcspn(url, ":")); + if (s && s[0]) { + return s; + } + return "INVALID URL SCHEME"; +} + + static int mb_handler(request_rec *r) { mb_dir_conf *cfg = NULL; @@ -1813,7 +1825,8 @@ for (i = 0; i < mirrors_same_prefix->nelts; i++) { if (pref) pref--; mirror = mirrorp[i]; - ap_rprintf(r, " <url type=\"http\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + ap_rprintf(r, " <url type=\"%s\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + url_scheme(r->pool, mirror->baseurl), mirror->country_code, pref, mirror->baseurl, filename); @@ -1827,7 +1840,8 @@ if (mirror->prefix_only) continue; if (pref) pref--; - ap_rprintf(r, " <url type=\"http\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + ap_rprintf(r, " <url type=\"%s\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + url_scheme(r->pool, mirror->baseurl), mirror->country_code, pref, mirror->baseurl, filename); @@ -1842,7 +1856,8 @@ if (mirror->prefix_only || mirror->as_only) continue; if (pref) pref--; - ap_rprintf(r, " <url type=\"http\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + ap_rprintf(r, " <url type=\"%s\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + url_scheme(r->pool, mirror->baseurl), mirror->country_code, pref, mirror->baseurl, filename); @@ -1856,7 +1871,8 @@ if (mirror->prefix_only || mirror->as_only || mirror->country_only) continue; if (pref) pref--; - ap_rprintf(r, " <url type=\"http\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + ap_rprintf(r, " <url type=\"%s\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + url_scheme(r->pool, mirror->baseurl), mirror->country_code, pref, mirror->baseurl, filename); @@ -1871,7 +1887,8 @@ continue; } if (pref) pref--; - ap_rprintf(r, " <url type=\"http\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + ap_rprintf(r, " <url type=\"%s\" location=\"%s\" preference=\"%d\">%s%s</url>\n", + url_scheme(r->pool, mirror->baseurl), mirror->country_code, pref, mirror->baseurl, filename); _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Wed Feb 10 2010 - 02:03:40 GMT
This archive was generated by hypermail 2.2.0 : Wed Feb 10 2010 - 02:17:14 GMT