Greetings all,

I've applied this patch to 3.2.0 CVS.  Since encoding will usually be 
used fairly consistently, I think it is OK just to compare encoded 
strings (since the alternative of decoding every matching URL is less 
efficient).  What do others think?

Lachlan

On Tue, 18 Nov 2003 01:34, Jean-Sebastien Morisset wrote:
> I found a bug in v3.1.6, and probably in all future versions too.
> Here it is:
>
> If you enter a "restrict" value in the URL for htsearch (not in the
> config file), it will be compared UNENCODED to the ENCODED URLs in
> htdig's database.
>
> For example, the following query:
>
> http://www.mvpix.com/cgi-bin/perl/search?words=%2A&restrict=/photos
>/021/Netherland%20Antilles/Bonaire/Places/Urban/&method=and&sort=dat
>e&format=short
>
> Will never match:
>
> http://www.mvpix.com/photos/021/Netherland%20Antilles/Bonaire/Place
>s/Urban/Industry/20030511-062204.jpg.html
>
> I've fixed htsearch temporarily with the following code, but some
> thought probably should be given on how to address this. I suspect
> the solution is to compare both strings in their unencoded form.
>
> My snippet:
>
> [EMAIL PROTECTED]:/mnt/lan/src/htdig-3.1.6$ diff htsearch/htsearch.cc-orig
> htsearch/htsearch.cc 23a24
>
> > #include "URL.h"
>
> 169,170c170,174
> <     if (input.exists("restrict"))
> <   config.Add("restrict", input["restrict"]);
> ---
>
> >   if (input.exists("restrict")) {
> >     String restrict_url = input["restrict"];
> >     encodeURL(restrict_url, "-_./");
> >     config.Add("restrict", restrict_url);
> >   }
>
> [EMAIL PROTECTED]:/mnt/lan/src/htdig-3.1.6$
>
> Another side-effect of using 'config.Add("restrict",
> input["restrict"]);' un-encoded is that any spaces will be treated
> as ORs later on by this line 'urllist.Create(config["restrict"], "|
> \t\r\n\001");'.
>
> BTW, this same bug affects the "exclude" value too.

-- 
[EMAIL PROTECTED]
ht://Dig developer DownUnder  (http://www.htdig.org)


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
ht://Dig Developer mailing list:
[EMAIL PROTECTED]
List information (subscribe/unsubscribe, etc.)
https://lists.sourceforge.net/lists/listinfo/htdig-dev

Reply via email to