httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject svn commit: r231340 - in /httpd/mod_mbox/trunk/module-2.0: mod-mbox-util.c mod_mbox_index.c
Date Wed, 10 Aug 2005 22:17:08 GMT
Author: jerenkrantz
Date: Wed Aug 10 15:16:59 2005
New Revision: 231340

URL: http://svn.apache.org/viewcvs?rev=231340&view=rev
Log:
Be more forgiving if a list doesn't have the List-Post header.

* module-2.0/mod_mbox_index.c: If we don't have the list/domain info, don't
  display the list summary information; Make it such that the 'site index'
  link appears when the list summary isn't shown.
* module-2.0/mod-mbox-util.c: If we don't see the List-Post, store "" rather
  than erroring out.

Modified:
    httpd/mod_mbox/trunk/module-2.0/mod-mbox-util.c
    httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c

Modified: httpd/mod_mbox/trunk/module-2.0/mod-mbox-util.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod-mbox-util.c?rev=231340&r1=231339&r2=231340&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod-mbox-util.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod-mbox-util.c Wed Aug 10 15:16:59 2005
@@ -165,8 +165,10 @@
     apr_dir_close(dir);
 
     if (files->nelts == 0) {
-        apr_file_printf(errfile, "Error: No mbox Files found in '%s'" NL,
-                        r->filename);
+        if (verbose) {
+          apr_file_printf(errfile, "Error: No mbox Files found in '%s'" NL,
+                          r->filename);
+        }
         return EXIT_FAILURE;
     }
 
@@ -187,42 +189,56 @@
       }
     }
 
+    /* This only happens if we have empty archives. */
+    if (i == files->nelts) {
+        if (verbose) {
+            apr_file_printf(errfile, "Archive %s empty" NL,
+                            r->filename);
+        }
+        return EXIT_FAILURE;
+    }
+
     if (verbose) {
-        apr_file_printf(errfile, "Scaning %s for Mailing List info" NL,
+        apr_file_printf(errfile, "Scanning %s for Mailing List info" NL,
                         file);
     }
 
     ml = mbox_get_list_post(r, file);
 
     if (!ml) {
-        apr_file_printf(errfile, "Error: Reading List-Post header "
-                        "from '%s' failed" NL, file);
-        return EXIT_FAILURE;
-    }
-
-    domain = strchr(ml, '@');
-    if (!domain) {
-        apr_file_printf(errfile, "Error: Failed to parse domain name "
-                        "from '%s'" NL, ml);
-        return EXIT_FAILURE;
-    }
-
-    *domain = '\0';
-    *domain++;
-
-    list = strchr(ml, ':');
-    if (!list) {
-        apr_file_printf(errfile, "Error: Failed to parse list name "
-                        "from '%s'" NL, ml);
-        return EXIT_FAILURE;
-    }
-    *list = '\0';
-    *list++;
-
-    ml = strrchr(domain, '>');
-
-    if (ml) {
-        *ml = '\0';
+        if (verbose) {
+            apr_file_printf(errfile, "Warning: Reading List-Post header "
+                            "from '%s' failed" NL, file);
+        }
+        domain = "";
+        list = "";
+    }
+    else {
+        domain = strchr(ml, '@');
+        if (!domain) {
+            apr_file_printf(errfile, "Error: Failed to parse domain name "
+                            "from '%s'" NL, ml);
+            return EXIT_FAILURE;
+        }
+
+        *domain = '\0';
+        *domain++;
+
+        list = strchr(ml, ':');
+        if (!list) {
+            apr_file_printf(errfile, "Error: Failed to parse list name "
+                            "from '%s'" NL, ml);
+            return EXIT_FAILURE;
+        }
+
+        *list = '\0';
+        *list++;
+
+        ml = strrchr(domain, '>');
+
+        if (ml) {
+            *ml = '\0';
+        }
     }
 
     if (verbose) {

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c?rev=231340&r1=231339&r2=231340&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox_index.c Wed Aug 10 15:16:59 2005
@@ -32,14 +32,11 @@
                       list, sub, domain);
 }
 
-static int show_list_info(request_rec *r, mbox_cache_info* mli)
+static int show_list_info(request_rec *r, mbox_cache_info* mli, dir_cfg *conf)
 {
     char dstr[APR_RFC822_DATE_LEN];
     char* list;
     char* domain;
-    dir_cfg *conf;
-
-    conf = ap_get_module_config(r->per_dir_config, &mbox_module);
 
     list = ESCAPE_OR_BLANK(r->pool, mli->list);
     domain = ESCAPE_OR_BLANK(r->pool, mli->domain);
@@ -109,6 +106,7 @@
     apr_finfo_t finfo;
     apr_array_header_t* files;
     mbox_cache_info* mli;
+    dir_cfg *conf;
     int i;
 
     rv = mbox_cache_get(&mli, r->filename, r->pool);
@@ -132,6 +130,8 @@
         return HTTP_FORBIDDEN;
     }
 
+    conf = ap_get_module_config(r->per_dir_config, &mbox_module);
+
     /* Try to make the index page more cache friendly */
     ap_update_mtime(r, mli->mtime);
     ap_set_last_modified(r);
@@ -162,8 +162,8 @@
              "<head>\n<title>", r);
 
 
-    if (files->nelts != 0) {
-        show_list_info(r, mli);
+    if (files->nelts != 0 && mli->list && mli->list[0]) {
+        show_list_info(r, mli, conf);
     }
     else {
         ap_rputs("No List Information", r);
@@ -171,6 +171,10 @@
                  "<body\n bgcolor=\"#FFFFFF\" text=\"#000000\" "
                  "link=\"#0000FF\" vlink=\"#000080\" alink=\"#FF0000\">\n",
                  r);
+        if (conf->root_url) {
+            ap_rprintf(r, "<h2><a href=\"%s\">Site Index</a></h2>\n",
+                       conf->root_url);
+        }
     }
     ap_rputs("<table width=\"100%\">\n", r);
     ap_rputs("<tr><th align=\"left\" width=\"15%\">Date</th>"



Mime
View raw message