[mirrorbrain-commits] r8150 - in /trunk/mod_mirrorbrain: mod_mirrorbrain.c mod_mirrorbrain.conf

From: <poeml_at_mirrorbrain.org>
Date: Sun, 19 Sep 2010 18:14:23 -0000
Author: poeml
Date: Sun Sep 19 20:14:23 2010
New Revision: 8150

URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=8150&view=rev
Log:
mod_mirrorbrain:
- allow to switch off inclusion of filenames with hashes server-wide (and
  therewith server-side) (see issue #68), with the new directive
    MirrorBrainHashesSuppressFilenames On
  in virtualhost context.

Modified:
    trunk/mod_mirrorbrain/mod_mirrorbrain.c
    trunk/mod_mirrorbrain/mod_mirrorbrain.conf

Modified: trunk/mod_mirrorbrain/mod_mirrorbrain.c
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mod_mirrorbrain/mod_mirrorbrain.c?rev=8150&r1=8149&r2=8150&view=diff
==============================================================================
--- trunk/mod_mirrorbrain/mod_mirrorbrain.c (original)
+++ trunk/mod_mirrorbrain/mod_mirrorbrain.c Sun Sep 19 20:14:23 2010
_at_@ -251,6 +251,7 @@
     const char *mirrorlist_stylesheet;
     const char *mirrorlist_header;
     const char *mirrorlist_footer;
+    int only_hash;
     const char *query;
     const char *query_label;
     const char *query_hash;
_at_@ -433,6 +434,7 @@
     new->mirrorlist_stylesheet = NULL;
     new->mirrorlist_header = NULL;
     new->mirrorlist_footer = NULL;
+    new->only_hash = UNSET;
     new->query = DEFAULT_QUERY;
     new->query_label = NULL;
     new->query_hash = DEFAULT_QUERY_HASH;
_at_@ -464,6 +466,7 @@
     cfgMergeString(mirrorlist_stylesheet);
     cfgMergeString(mirrorlist_header);
     cfgMergeString(mirrorlist_footer);
+    cfgMergeBool(only_hash);
     mrg->query = (add->query != (char *) DEFAULT_QUERY) ? add->query : base->query;
     cfgMergeString(query_label);
     mrg->query_hash = (add->query_hash != (char *) DEFAULT_QUERY_HASH) 
_at_@ -713,6 +716,17 @@
     new->port = atoi(apr_pstrdup(cmd->pool, arg2));
     if (new->port <= 0)
         return "MirrorBrainDHTNode requires a positive integer as second argument (server port).";
+    return NULL;
+}
+
+static const char *mb_cmd_hashes_suppress_filenames(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->only_hash = flag;
     return NULL;
 }
 
_at_@ -1589,7 +1603,7 @@
 
         if (h && h[0]) {
             ap_set_content_type(r, "text/plain; charset=UTF-8");
-            if (only_hash) {
+            if (only_hash || (scfg->only_hash == 1) ) {
                 ap_rprintf(r, "%s\n", h);
             }
             else {
_at_@ -3273,6 +3287,12 @@
                   "Prefix this path when looking for prepared hashes to inject into metalinks. "
                   "This directive is obsolete (with 2.13.0) and is going to be removed later."),
 
+    AP_INIT_FLAG("MirrorBrainHashesSuppressFilenames", mb_cmd_hashes_suppress_filenames, NULL,
+                  RSRC_CONF, 
+                  "Set to On to suppress the filename included when hashes are sent. "
+                  "Normally, they come as \"99eaed37390ba0571f8d285829ff63fc  foobar\" "
+                  "as in the format well-known from the md5sum/sha1sum tools. Default: Off"),
+
     AP_INIT_TAKE2("MirrorBrainMetalinkPublisher", mb_cmd_metalink_publisher, NULL, 
                   RSRC_CONF, 
                   "Name and URL for the metalinks publisher elements"),

Modified: trunk/mod_mirrorbrain/mod_mirrorbrain.conf
URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/mod_mirrorbrain/mod_mirrorbrain.conf?rev=8150&r1=8149&r2=8150&view=diff
==============================================================================
--- trunk/mod_mirrorbrain/mod_mirrorbrain.conf (original)
+++ trunk/mod_mirrorbrain/mod_mirrorbrain.conf Sun Sep 19 20:14:23 2010
_at_@ -17,6 +17,12 @@
     # Absolute path to footer to be appended to the mirror
     # lists/details pages, instead of the built-in footer
     MirrorBrainMirrorlistFooter /srv/www/htdocs/mb-footer.html
+
+    # Set to On to suppress the filename included when hashes are sent.
+    # Normally, they come as "99eaed37390ba0571f8d285829ff63fc  foobar", 
+    # as in the format well-known from the md5sum/sha1sum tools.
+    # Default: Off
+    MirrorBrainHashesSuppressFilenames Off
 
     # Available details for logging with the CustomLog directive:
     # %{Location}o                the full redirection URL




_______________________________________________
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 Sun Sep 19 2010 - 18:14:25 GMT

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