httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From max...@apache.org
Subject svn commit: r357200 - in /httpd/mod_mbox/trunk/module-2.0: Makefile.am mbox_date.c mbox_date.h mbox_externals.c mbox_externals.h mbox_parse.c mod_mbox.c
Date Fri, 16 Dec 2005 18:04:54 GMT
Author: maxime
Date: Fri Dec 16 10:04:33 2005
New Revision: 357200

URL: http://svn.apache.org/viewcvs?rev=357200&view=rev
Log:
Include our own strcasestr function, called mbox_strcasestr(), copied
from ap_strcasestr() (httpd/server/util.c). Indeed, mod-mbox-util,
which is *not* linked against HTTPd, needs a portable strcasestr
function, and system's strcasestr() does not work on Solaris.

Since this is not the only external function bundled in mod_mbox (for
different reasons), they are all included in the mbox_externals.[ch]
files, moved from previous mbox_date.[ch] files. Makefile has been
updated.


Added:
    httpd/mod_mbox/trunk/module-2.0/mbox_externals.c
      - copied, changed from r357144, httpd/mod_mbox/trunk/module-2.0/mbox_date.c
    httpd/mod_mbox/trunk/module-2.0/mbox_externals.h
      - copied, changed from r357144, httpd/mod_mbox/trunk/module-2.0/mbox_date.h
Removed:
    httpd/mod_mbox/trunk/module-2.0/mbox_date.c
    httpd/mod_mbox/trunk/module-2.0/mbox_date.h
Modified:
    httpd/mod_mbox/trunk/module-2.0/Makefile.am
    httpd/mod_mbox/trunk/module-2.0/mbox_parse.c
    httpd/mod_mbox/trunk/module-2.0/mod_mbox.c

Modified: httpd/mod_mbox/trunk/module-2.0/Makefile.am
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/Makefile.am?rev=357200&r1=357199&r2=357200&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/Makefile.am (original)
+++ httpd/mod_mbox/trunk/module-2.0/Makefile.am Fri Dec 16 10:04:33 2005
@@ -1,5 +1,5 @@
 libmboxutil_la_SOURCES = mbox_search.c mbox_cache.c mbox_parse.c \
-                         mbox_sort.c mbox_thread.c mbox_date.c
+                         mbox_sort.c mbox_thread.c mbox_externals.c
 libmboxutil_la_CFLAGS = -Wall ${MODULE_CFLAGS}
 libmboxutil_la_LDFLAGS =  -avoid-version ${MODULE_LDFLAGS}
 

Copied: httpd/mod_mbox/trunk/module-2.0/mbox_externals.c (from r357144, httpd/mod_mbox/trunk/module-2.0/mbox_date.c)
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mbox_externals.c?p2=httpd/mod_mbox/trunk/module-2.0/mbox_externals.c&p1=httpd/mod_mbox/trunk/module-2.0/mbox_date.c&r1=357144&r2=357200&rev=357200&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_date.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_externals.c Fri Dec 16 10:04:33 2005
@@ -17,13 +17,18 @@
 /** THIS FILE MUST BE REMOVED WHEN THE APR-UTIL LIBRARY WILL BE FIXED
  * AND PACKAGED. */
 
-/* Since the apr_date_parse_rfc() function is buggy in current
- * versions of the Apache Portable Runtime Library, we use a fixed *
- * version copied here while the fixed version will be uploaded and *
- * available.
+/* mbox_date_parse_rfc: Since the apr_date_parse_rfc() function is
+ * buggy in current versions of the Apache Portable Runtime Library,
+ * we use a fixed version copied here while the fixed version will be
+ * uploaded and available.
+ *
+ * mbox_strcasestr: ap_strcasestr is currently held in HTTPd source
+ * code instead of APR. strcasestr is not portable on Solaris, and we
+ * need a portable strcasestr even without linking to HTTPd (for
+ * mod-mbox-util).
  */
 
-#include "mbox_date.h"
+#include "mbox_externals.h"
 
 #if APR_HAVE_STDLIB_H
 #include <stdlib.h>
@@ -391,4 +396,39 @@
         return APR_DATE_BAD;
 
     return result;
+}
+
+/*
+ * Similar to standard strstr() but we ignore case in this version.
+ * Based on the strstr() implementation further below.
+ */
+char *mbox_strcasestr(const char *s1, const char *s2)
+{
+    char *p1, *p2;
+    if (*s2 == '\0') {
+        /* an empty s2 */
+        return((char *)s1);
+    }
+    while(1) {
+        for ( ; (*s1 != '\0') && (apr_tolower(*s1) != apr_tolower(*s2)); s1++);
+        if (*s1 == '\0') {
+            return(NULL);
+        }
+        /* found first character of s2, see if the rest matches */
+        p1 = (char *)s1;
+        p2 = (char *)s2;
+        for (++p1, ++p2; apr_tolower(*p1) == apr_tolower(*p2); ++p1, ++p2) {
+            if (*p1 == '\0') {
+                /* both strings ended together */
+                return((char *)s1);
+            }
+        }
+        if (*p2 == '\0') {
+            /* second string ended, a match */
+            break;
+        }
+        /* didn't find a match here, try starting at next character in s1 */
+        s1++;
+    }
+    return((char *)s1);
 }

Copied: httpd/mod_mbox/trunk/module-2.0/mbox_externals.h (from r357144, httpd/mod_mbox/trunk/module-2.0/mbox_date.h)
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mbox_externals.h?p2=httpd/mod_mbox/trunk/module-2.0/mbox_externals.h&p1=httpd/mod_mbox/trunk/module-2.0/mbox_date.h&r1=357144&r2=357200&rev=357200&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_date.h (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_externals.h Fri Dec 16 10:04:33 2005
@@ -17,8 +17,8 @@
 /** THIS FILE MUST BE REMOVED WHEN THE APR-UTIL LIBRARY WILL BE FIXED
  * AND PACKAGED. */
 
-#ifndef MBOX_DATE_H
-#define MBOX_DATE_H
+#ifndef MBOX_EXTERNALS_H
+#define MBOX_EXTERNALS_H
 
 #define CORE_PRIVATE
 #include "apr.h"
@@ -33,9 +33,10 @@
 #define APR_DATE_BAD ((apr_time_t)0)
 
 apr_time_t mbox_date_parse_rfc(const char *date);
+char *mbox_strcasestr(const char *s1, const char *s2);
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* MBOX_DATE_H */
+#endif /* MBOX_EXTERNALS_H */

Modified: httpd/mod_mbox/trunk/module-2.0/mbox_parse.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mbox_parse.c?rev=357200&r1=357199&r2=357200&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mbox_parse.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mbox_parse.c Fri Dec 16 10:04:33 2005
@@ -35,8 +35,8 @@
 #include "mbox_sort.h"
 #include "mbox_search.h"
 
-/* FIXME: Remove this when apr_date_parse_rfc() is fixed ! */
-#include "mbox_date.h"
+/* FIXME: Remove this when apr_date_parse_rfc() and ap_strcasestr() are fixed ! */
+#include "mbox_externals.h"
 
 #include "apr_dbm.h"
 #include "apr_hash.h"
@@ -837,7 +837,7 @@
                 if (temp) {
                     char* p;
                     temp = apr_pstrdup(tpool, temp);
-                    msgc.boundary = ap_strcasestr(temp, "boundary=");
+                    msgc.boundary = mbox_strcasestr(temp, "boundary=");
                     if (msgc.boundary) {
                         msgc.boundary += sizeof("boundary=") - 1;
                         if (msgc.boundary[0] == '"') {

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox.c
URL: http://svn.apache.org/viewcvs/httpd/mod_mbox/trunk/module-2.0/mod_mbox.c?rev=357200&r1=357199&r2=357200&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox.c Fri Dec 16 10:04:33 2005
@@ -56,7 +56,8 @@
     conf = apr_pcalloc(p, sizeof(mbox_dir_cfg_t));
 
     conf->enabled = 0;
-    conf->hide_empty = 0;
+    conf->hide_empty = 1;
+    conf->antispam = 1;
     conf->root_path = NULL;
     conf->search_path = NULL;
     conf->style_path = NULL;



Mime
View raw message