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

From: <poeml_at_mirrorbrain.org>
Date: Sat, 18 Sep 2010 22:25:56 -0000
Author: poeml
Date: Sun Sep 19 00:25:56 2010
New Revision: 8141

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8141&view=rev
Log:
mod_mirrorbrain:
- Hashes can now be requested without filename in the returned response, by
  sending "only_hash" as query_string, i.e. 
     http://host.example.com/foo.md5?only_hash 
     http://host.example.com/foo?md5&only_hash
  This hopefully fixes issue #68 :-)

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=8141&r1=8140&r2=8141&view=diff
==============================================================================
--- trunk/mod_mirrorbrain/mod_mirrorbrain.c (original)
+++ trunk/mod_mirrorbrain/mod_mirrorbrain.c Sun Sep 19 00:25:56 2010
_at_@ -1081,7 +1081,7 @@
     const char *clientip = NULL;
     const char *query_country = NULL;
     char *query_asn = NULL;
-    char fakefile = 0, newmirror = 0;
+    char fakefile = 0, newmirror = 0, only_hash = 0;
     int rep = UNKNOWN;                          /* type of a requested representation */
     char *rep_ext = NULL;                       /* extension string of a requested representation */
     char meta_negotiated = 0;                   /* a metalink representation was chosed by negotiation, i.e.
_at_@ -1185,6 +1185,7 @@
         if (form_lookup(r, "sha1"))    { rep = SHA1;    rep_ext = reps[SHA1].ext; };
         if (form_lookup(r, "sha256"))  { rep = SHA256;  rep_ext = reps[SHA256].ext; };
         if (form_lookup(r, "btih"))    { rep = BTIH;    rep_ext = reps[BTIH].ext; };
+        if (form_lookup(r, "only_hash")) { only_hash = 1; };
     }
     
     if (!query_country 
_at_@ -1560,7 +1561,12 @@
 
         if (h && h[0]) {
             ap_set_content_type(r, "text/plain; charset=UTF-8");
-            ap_rprintf(r, "%s  %s\n", h, basename);
+            if (only_hash) {
+                ap_rprintf(r, "%s\n", h);
+            }
+            else {
+                ap_rprintf(r, "%s  %s\n", h, basename);
+            }
             setenv_give(r, reps[rep].ext);
             return OK;
         }




_______________________________________________
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 Sat Sep 18 2010 - 22:25:58 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT