From: Jeroen v. d. W. <je...@st...> - 2011-03-18 13:46:07
|
Thanks Fabian, I'm still struggeling on this but will investigate more time to accomplish this. TMHO the -redirect is not working. Can't find any documentation on in either. Here's a link to my final goal: http://www.google.com/support/websearch/bin/answer.py?hl=en&answer=186669 Jeroen PS Here's an article mentioning Privoxy as best Linux content filter: http://www.techradar.com/news/software/applications/6-of-the-best-content-filters-for-linux-698307?artc_pg=4 Keep up the good work! On Sun, Mar 13, 2011 at 2:44 PM, Fabian Keil <fk...@fa...> wrote: > Jeroen van der Wal <je...@st...> wrote: > > [Quoting adjusted] > > > On Mon, Mar 7, 2011 at 6:34 PM, Fabian Keil <fk...@fa...> wrote: > > > > > Jeroen van der Wal <je...@st...> wrote: > > > > > > > The code below results in a infinite redirect loop: > > > > > > > > # Set safesearch to strict on Google image search > > > > {+redirect{s@(^http:.*\q=.*)@$1&safe=vss@}} > > > > .google.com/images.*$ > > > > > > > > Is there a way to prevent this loop? > > > > > > There are several ways, actually: > > > > > > 1. Adjust the URL pattern, so it doesn't match the rewritten URL. > > > 2. Adjust the pcrs command, so it doesn't rewrite the already rewritten > > > URL. > > > 3. Explicitly disable the redirect action for the rewritten URL. > > > 4. Tag requests for the rewritten URL and then use the tag to disable > the > > > redirect. > > > 5. A combination of the options above. > > > How exactly should I manage option #2 and #3? I've gone trough all the > > documentation and the only thing I found was adding the dollar sign to > the > > url pattern (see example code) but this does not work. > > For #2, you could use negative assertions. They aren't > Privoxy-specific, but PCRE features and documented in > PCRE's pcrepattern manual page. > > For #3, you simply add another section with -redirect > and an URL pattern like ".google.com/images.*&safe=vss". > > The dollar sign you added does nothing useful because > of the ".*" in front of it. > > It's used differently in the documentation at: > http://config.privoxy.org/user-manual/actions-file.html#REDIRECT > > | # Always use the expanded view for Undeadly.org articles > | # (Note the $ at the end of the URL pattern to make sure > | # the request for the rewritten URL isn't redirected as well) > | {+redirect{s@$@&mode=expanded@}} > | undeadly.org/cgi\?action=article&sid=\d*$<http://undeadly.org/cgi%5C?action=article&sid=%5Cd*$> > > After the redirect, the URL will end with "&mode=expanded", > but due to the "$" in the URL pattern the URL has to end in > "&sid=" followed by any number of digits for the action to > be enabled again. > > Fabian > |