aseek-devel  

Re: [aseek-devel] Some patches for aspseek (CVS)

Jens Thoms Toerring
Tue, 26 Aug 2003 16:49:58 +0000

On Tue, Aug 26, 2003 at 07:56:06PM +0359, Kir Kolyshkin wrote:
> Jens, could you sent a patches in the form of separate (one patch per 
> problem) unified diffs?

Sorry, yes of course. Here's the one for filters.cpp (i.e. having a slash
appended to "naked" URLs without a path in order to have filter rules
like "\/$" apply to them).
                                        Regards, Jens
-- 
 Freie Universitaet Berlin     Jens Thoms Toerring
 Universitaetsbibliothek
 Webteam                       Tel: 0049 30 838 56055
 Garystrasse 39                Fax: 0049 30 838 53738
 14195 Berlin                  e-mail: [EMAIL PROTECTED]


--- aspseek-orig/src/filters.cpp        2003-08-20 16:11:58.000000000 +0200
+++ aspseek-my/src/filters.cpp  2003-08-26 18:41:50.000000000 +0200
@@ -95,6 +95,18 @@
 
 int CFilters::FilterType(const char * param, char * reason, CWordCache* wcache)
 {
+    char *new_param = alloca( strlen( param ) + 2 );
+    char *p1;
+
+       // Make sure the URL ends with a slash if this is an URL without a path,
+       // e.g. "http://www.xxx.yyy";, otherwise a filter rule like "\/$" does
+       // not apply even though it really should
+
+    strcpy( new_param, param );
+    p1 = strchr( new_param, ':' ) + 3;
+    if ( strchr( p1, '/' ) == NULL )
+        strcat( new_param, "/" );
+
        CTimerAdd timer(m_time);
        for (iterator filter = begin(); filter != end(); filter++)
        {