[Privoxy-users] external-filter example
Lee
ler762 at gmail.com
Fri Jul 24 22:38:20 UTC 2020
On 7/23/20, U.Mutlu <um at mutluit.com> wrote:
> Lee wrote on 07/23/2020 05:15 AM:
>> On 7/22/20, U.Mutlu <um at mutluit.com> wrote:
>>> A working example for such an external-filter would be helpful.
>>> Unfortunately I couldn't find any on the web :-(
>>
>> How about
>> http://config.privoxy.org/user-manual/actions-file.html#SERVER-HEADER-TAGGER
>>
>> Add this to your user.action:
<.. snip ..>
> Thx, finally got it working with these settings:
>
> file my.filter:
> EXTERNAL-FILTER: myTee make a copy of reveived text
> /usr/bin/tee /tmp/myTee_Test.txt
>
> file my.action:
> {{alias}}
> { +server-header-tagger{content-type} +external-filter{myTee}}
> /
> TAG:^text/html
>
> But the output is "meager": it always just says "301 Moved Permanently" with
> all URLs:
Two things:
1. you need the "-a" option on tee to append instead of overwriting the file
I did a quick test and, at least for me, "tee -a output" didn't lose anything
$ cat x
(for x in $(seq 0 9); do echo "1 $x" | tee -a /tmp/output ; sleep 0.1; done ) &
(for x in $(seq 0 9); do echo "2 $x" | tee -a /tmp/output ; sleep 0.1; done ) &
(for x in $(seq 0 9); do echo "3 $x" | tee -a /tmp/output ; sleep 0.1; done ) &
(for x in $(seq 0 9); do echo "4 $x" | tee -a /tmp/output ; sleep 0.1; done ) &
$ wc -l /tmp/output
40 /tmp/output
> # cat /tmp/myTee_Test.txt
> <html>
> <head><title>301 Moved Permanently</title></head>
> <body bgcolor="white">
> <center><h1>301 Moved Permanently</h1></center>
> <hr><center>CloudFront</center>
> </body>
> </html>
2. It would help if you showed the URL you're using for testing. A
'301 Moved Permanently' should give you the new location; I don't
understand why that isn't showing up.. but if the 'moved to' location
doesn't return a content type of "text/html" that would explain why
you're not capturing that output
> So, it seems the https-MITM isn't working in my build.
If you're using https:// URLs for your testing the https inspection in working.
> I had used old version (2.4.2) of mbedtls (that from Debian 8 repo).
>
> Lee, you said https-MITM would work with the latest dev version.
> Does it work due to the newer mbedtls version?
I don't know. I've only tried building privoxy with mbed-tls 2.16.6 and .7
> Or what else do I need to get the full content of the HTML file?
You need to add the "-a" option in your filter so your output file
isn't overwritten:
EXTERNAL-FILTER: myTee make a copy of reveived text
/usr/bin/tee -a /tmp/myTee_Test.txt
And check the content-type of the received html to see if it's
text/html or something else that doesn't trigger the filter. If you
can't think of some other way to check, add
debug 8 # show header parsing - helpful but verbose
to the privoxy config to see the content type (and much, much more)
Regards,
Lee
More information about the Privoxy-users
mailing list