[prev in list] [next in list] [prev in thread] [next in thread] 

List:       privoxy-developers
Subject:    [privoxy-devel] [ ijbswa-Bugs-1619208 ] filter-file without valid
From:       "SourceForge.net" <noreply () sourceforge ! net>
Date:       2006-12-22 14:28:54
Message-ID: E1GxlOI-0007rY-6P () sc8-sf-web6 ! sourceforge ! net
[Download RAW message or body]

Bugs item #1619208, was opened at 2006-12-20 04:42
Message generated for change (Comment added) made by fabiankeil
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=111118&aid=1619208&group_id=11118

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: funct: filtering
Group: None
> Status: Pending
> Resolution: Fixed
Priority: 5
Private: No
Submitted By: Justin McMurtry (jdmx)
Assigned to: Fabian Keil (fabiankeil)
Summary: filter-file without valid filter defs aborts processing

Initial Comment:
Privoxy allows an arbitrary number of filter files to be specified in its \
configuration file. Normally, whenever a filter is invoked by an action file, Privoxy \
looks up the filter's definition by searching through ALL of the specified filter \
files, in the same sequence as they are named in the config file. Even if a matching \
filter definition is found, Privoxy continues searching until ALL filter files have \
been examined, and the last matching definition found is the one that Privoxy uses to \
execute the filter request.

However, as I discovered today, there is presently a bug in this process: If during \
its sequential walk through all the specified filter files, Privoxy encounters a \
filter file that does not contain ANY valid filter definitions (such as an unmodified \
"user.filter" template file, or simply an empty file), then Privoxy aborts its walk \
and treats that file as if it were the last, even if there are other config-specified \
filter files yet to be examined.

To demonstrate this bug, first create the following three files and place them in the \
Privoxy directory:

"filter.empty" -- an empty file.

"filter.bozo.1" -- with the following contents:
     FILTER: bozo
     s|.*|<html><body><p>Bozo 1!</p></body></html>|s

"filter.bozo.2" -- with the following contents:
     FILTER: bozo
     s|.*|<html><body><p>Bozo 2!</p></body></html>|s

Next, add the following lines at the very end of your "user.action" file:
     {filter{bozo}}
     /.*bozo

Now, edit the "filterfile" section of your Privoxy config file so that the only valid \
lines (not commented out) are exactly as follows:

     filterfile filter.bozo.1
     filterfile filter.bozo.2
     filterfile filter.empty

Next, either stop and then restart Privoxy from the command line, or open the Privoxy \
UI in your Web browser and open the View Status page (<http://p.p/show-status>) and \
view the list of filter files that are in use. (If you didn't restart Privoxy, you \
may need to refresh the page once or twice to update the list.) Note that the two \
"bozo" filter files are listed, but the empty one is not, even though it's specified \
in the config file.

Now, attempt to open "www.privoxy.org/?bozo" in your Web browser. You should get a \
page that says only "Bozo 2!" (If not, refresh the page a couple of times.) This \
shows that Privoxy is finding and using the "bozo" filter definition in the second \
filter-file it examined, "filter.bozo.2" (after having first found the definition in \
"filter.bozo.1").

Next, reopen your config file and change the sequence of the specified filter-files \
to be as follows:

     filterfile filter.bozo.1
     filterfile filter.empty
     filterfile filter.bozo.2

Save the changes, go back to your Web browser, and refresh the page twice. You will \
see the result change to "Bozo 1!" This shows that Privoxy is finding the filter \
definition in "filter.bozo.1", and is applying that definition because it's no longer \
finding it in "filter.bozo.2" -- because it's first encountering "filter.empty", \
finding no filter definitions inside, and aborting its search.

Reopen your config file once more and change the filterfile sequence to be as \
follows:

     filterfile filter.empty
     filterfile filter.bozo.1
     filterfile filter.bozo.2

After saving the changes, return to your Web browser and refresh the page twice. You \
will now see home page of Privoxy's Web site. This shows that although the "bozo" \
filter is being invoked, it's not being applied. The reason is that Privoxy can't \
find a definition for it, which in turn is because Privoxy is not examining any \
filter files after "filter.empty".

As demonstrated here, this bug can cause filters that are validly defined and invoked \
to be erroneously ignored or misapplied.

Please note that exactly the same behavior is observed if an unmodified stock \
"user.filter" file is used instead of an empty file; what matters is not whether the \
file is empty, but whether it contains any valid filter definitions.

Incidentally, it might also be considered a bug that "filter.empty" does not appear \
in the list of filter files in use. If it really weren't in use, it wouldn't be \
producing the effects observed above. Perhaps it could be included in the list along \
with some sort of visual indication that it contains no valid filter definitions.

----------------------------------------------------------------------

> Comment By: Fabian Keil (fabiankeil)
Date: 2006-12-22 14:28

Message:
Logged In: YES 
user_id=875547
Originator: NO

Should be fixed with cgisimple.c,v 1.44 and filters.c,v 1.71.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=111118&aid=1619208&group_id=11118

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Ijbswa-developers mailing list
Ijbswa-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ijbswa-developers


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic