Author: poeml Date: Sat Sep 25 23:31:02 2010 New Revision: 8164 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8164&view=rev Log: mod_mirrorbrain: - The Magnet links embedded in Metalinks could causes aria2c to wait a long time on P2P connections, and not try the listed mirrors anymore (issue #73). The links are no longer included for the moment, unless MirrorBrainMetalinkMagnetLinks On is set in the Apache configuration. 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=8164&r1=8163&r2=8164&view=diff ============================================================================== --- trunk/mod_mirrorbrain/mod_mirrorbrain.c (original) +++ trunk/mod_mirrorbrain/mod_mirrorbrain.c Sat Sep 25 23:31:02 2010 _at_@ -248,6 +248,7 @@ apr_array_header_t *tracker_urls; apr_array_header_t *dhtnodes; const char *metalink_broken_test_mirrors; + int metalink_magnets; const char *mirrorlist_stylesheet; const char *mirrorlist_header; const char *mirrorlist_footer; _at_@ -431,6 +432,7 @@ new->tracker_urls = apr_array_make(p, 5, sizeof (char *)); new->dhtnodes = apr_array_make(p, 5, sizeof (dhtnode_t)); new->metalink_broken_test_mirrors = NULL; + new->metalink_magnets = UNSET; new->mirrorlist_stylesheet = NULL; new->mirrorlist_header = NULL; new->mirrorlist_footer = NULL; _at_@ -463,6 +465,7 @@ mrg->tracker_urls = apr_array_append(p, base->tracker_urls, add->tracker_urls); mrg->dhtnodes = apr_array_append(p, base->dhtnodes, add->dhtnodes); cfgMergeString(metalink_broken_test_mirrors); + cfgMergeBool(metalink_magnets); cfgMergeString(mirrorlist_stylesheet); cfgMergeString(mirrorlist_header); cfgMergeString(mirrorlist_footer); _at_@ -739,6 +742,18 @@ ap_get_module_config(s->module_config, &mirrorbrain_module); cfg->metalink_broken_test_mirrors = arg1; + return NULL; +} + +static const char *mb_cmd_metalink_magnet_links(cmd_parms *cmd, + void *config, + int flag) +{ + server_rec *s = cmd->server; + mb_server_conf *cfg = + ap_get_module_config(s->module_config, &mirrorbrain_module); + + cfg->metalink_magnets = flag; return NULL; } _at_@ -2396,20 +2411,18 @@ r->uri); } - switch (rep) { - case META4: - /* inclusion of torrents and other metaurls should probably happen here - * - * restrict the use of the new metaurl element to new metalinks */ - - /* <metaurl mediatype="torrent">http://example.com/example.ext.torrent</metaurl> */ - ap_rputs("\n\n <!-- Meta URLs -->\n", r); - if (hashbag != NULL && magnet != NULL) { + if ((scfg->metalink_magnets == 1) && (hashbag != NULL) && (magnet != NULL)) { + switch (rep) { + case META4: + /* inclusion of torrents and other metaurls should probably happen here + * + * restrict the use of the new metaurl element to new metalinks */ + + /* <metaurl mediatype="torrent">http://example.com/example.ext.torrent</metaurl> */ + ap_rputs("\n\n <!-- Meta URLs -->\n", r); ap_rprintf(r, " <metaurl mediatype=\"torrent\">%s</metaurl>\n", magnet); - } - break; - case METALINK: - if (hashbag != NULL && magnet != NULL) { + break; + case METALINK: ap_rprintf(r, " <url type=\"bittorrent\" preference=\"%d\">%s</url>\n\n", 100, magnet); } _at_@ -3311,6 +3324,10 @@ "links. Directive can be repeated to specify multiple nodes, and takes " "two arguments (hostname, port)."), + AP_INIT_FLAG("MirrorBrainMetalinkMagnetLinks", mb_cmd_metalink_magnet_links, NULL, + RSRC_CONF, + "If set to On, Magnet links will be included in Metalinks. Default is Off."), + AP_INIT_TAKE1("MirrorBrainMetalinkBrokenTestMirrors", mb_cmd_metalink_broken_test_mirrors, NULL, RSRC_CONF, "Filename with snippet to include at the top of a metalink's " _______________________________________________ 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 Sat Sep 25 2010 - 21:31:04 GMT
This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT