+
+
+
External filters are scripts or programs that can modify the content
+ in case common filters aren't powerful enough.
+
+
External filters can be written in any language the platform
+ Privoxy runs on supports.
+
+
They are controlled with the external-filter action and
+ have to be defined in the filterfile first.
+
+
The header looks like any other filter, but instead of pcrs jobs,
+ external filters contain a single job which can be a program or a shell
+ script (which may call other scripts or programs).
+
+
External filters read the content from STDIN and write the rewritten
+ content to STDOUT. The environment variables PRIVOXY_URL, PRIVOXY_PATH,
+ PRIVOXY_HOST, PRIVOXY_ORIGIN can be used to get some details about the
+ client request.
+
+
Privoxy will temporary store the
+ content to filter in the temporary-directory.
+
+
+
+
+
+EXTERNAL-FILTER: cat Pointless example filter that doesn't actually modify the content
+/bin/cat
+
+# Incorrect reimplementation of the filter above in POSIX shell.
+#
+# Note that it's a single job that spans multiple lines, the line
+# breaks are not passed to the shell, thus the semicolons are required.
+#
+# If the script isn't trivial, it is recommended to put it into an external file.
+#
+# In general, writing external filters entirely in POSIX shell is not
+# considered a good idea.
+EXTERNAL-FILTER: cat2 Pointless example filter that despite its name may actually modify the content
+while read line; \
+do \
+ echo "$line"; \
+done
+
+EXTERNAL-FILTER: rotate-image Rotate an image by 180 degree. Test filter with limited value.
+/usr/local/bin/convert - -rotate 180 -
+
+EXTERNAL-FILTER: citation-needed Adds a "[citation needed]" tag to an image. The coordinates may need adjustment.
+/usr/local/bin/convert - -pointsize 16 -fill white -annotate +17+418 "[citation needed]" -
+
+ |
+
+
+
+
+
+
+ Warning |
+
+
+
+
+ Currently external filters are executed with Privoxy's privileges! Only use external
+ filters you understand and trust.
+ |
+
+
+
+
+
External filters are experimental and the syntax may change in the
+ future.
+