[mirrorbrain-commits] r7989 - /trunk/mod_mirrorbrain/mod_mirrorbrain.c

From: <poeml_at_mirrorbrain.org>
Date: Fri, 12 Mar 2010 02:23:09 -0000
Author: poeml
Date: Fri Mar 12 03:23:07 2010
New Revision: 7989

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=7989&view=rev
Log:
mod_mirrorbrain:
- Fix confused order in magnet links after shuffling its arguments around
- Include magnet links in the mirror list

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=7989&r1=7988&r2=7989&view=diff
==============================================================================
--- trunk/mod_mirrorbrain/mod_mirrorbrain.c (original)
+++ trunk/mod_mirrorbrain/mod_mirrorbrain.c Fri Mar 12 03:23:07 2010
@@ -1783,17 +1783,19 @@
         case METALINK:
         case MIRRORLIST:
             magnet = apr_psprintf(r->pool, "magnet:"
-                          "&xl=%s"          /* size */
+                          "?xl=%s"          /* size */
                           "&dn=%s"          /* FIXME: the basename should be www-formencoded for
                                                       spaces or funny characters */
-                          "?xt=urn:sha1:%s"
-                          "?xt=urn:bith:%s" /* bittorrent information hash */
+                          "&xt=urn:sha1:%s"
+                          "&xt=urn:bith:%s" /* bittorrent information hash */
                           "&xt=urn:md5:%s", /* Gnutella */
                        apr_off_t_toa(r->pool, r->finfo.size), basename,
                        hashbag->sha1, hashbag->sha1, hashbag->md5); 
 
-             /* FIXME: including a tracker URL might be cool (&tr=<tracker-url>) 
+            /* FIXME: including a tracker URL might be cool (&tr=<tracker-url>) 
              * see http://mirrorbrain.org/issues/issue38 */
+            /* the URL to the file (for HTTP redirection) can also be included
+             * http://en.wikipedia.org/wiki/Magnet_URI_scheme#Normal_.28as.29 */
         }
     }
 
@@ -2188,22 +2190,25 @@
         ap_rprintf(r, "  <li>Last modified: %s (Unix time: %lld)</li>\n", time_str, r->finfo.mtime / 1000000);
 
         if (hashbag != NULL) {
-                    /* XXX we should link to the hash, but we need to build a handler for it first
-                     * <a href=\"http://%s%s.sha256\">(link)</a> */
-                    if (hashbag->sha256)
-                        ap_rprintf(r, "  <li>SHA-256 sum: <tt>%s</tt></li>\n", hashbag->sha256);
-                    if (hashbag->sha1)
-                        ap_rprintf(r, "  <li>SHA-1 sum: <tt>%s</tt></li>\n", hashbag->sha1);
-                    if (hashbag->md5)
-                        ap_rprintf(r, "  <li>MD5 sum: <tt>%s</tt></li>\n", hashbag->md5);
-
-                    /* XXX we could link to the signature
-                    if (hashbag->pgp) {
-                        ap_rputs("    <signature mediatype=\"application/pgp-signature\">\n", r);
-                        ap_rputs(hashbag->pgp, r);
-                        ap_rputs("    </signature>\n", r);
-                    }
-                    */
+            /* XXX we should link to the hash, but we need to build a handler for it first
+             * <a href=\"http://%s%s.sha256\">(link)</a> */
+            if (hashbag->sha256)
+                ap_rprintf(r, "  <li>SHA-256 sum: <tt>%s</tt></li>\n", hashbag->sha256);
+            if (hashbag->sha1)
+                ap_rprintf(r, "  <li>SHA-1 sum: <tt>%s</tt></li>\n", hashbag->sha1);
+            if (hashbag->md5)
+                ap_rprintf(r, "  <li>MD5 sum: <tt>%s</tt></li>\n", hashbag->md5);
+
+            /* XXX we could link to the signature
+            if (hashbag->pgp) {
+                ap_rputs("    <signature mediatype=\"application/pgp-signature\">\n", r);
+                ap_rputs(hashbag->pgp, r);
+                ap_rputs("    </signature>\n", r);
+            }
+            */
+            if (magnet) {
+                ap_rprintf(r, "  <li><a href=\"%s\">Magnet Link</a></li>\n", magnet);
+            }
         }
         ap_rputs("  </ul>\n", r);
 




_______________________________________________
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.org
Received on Fri Mar 12 2010 - 02:23:11 GMT

This archive was generated by hypermail 2.2.0 : Fri Mar 12 2010 - 02:32:18 GMT