PRIVOXY...ION-TEST(1)

okay bestie, buckle up 🫢 β€” this is the PRIVOXY...ION-TEST(1) manual page, aka the User Contributed Perl Documentation edition, and we're about to make a regression-test "framework" make sense. πŸ’…

πŸ’– NAME πŸ’–

privoxy-regression-test β€” A regression test "framework" for Privoxy.

✨ SYNOPSIS ✨

No cap, the synopsis is a whole lot, so here it is verbatim:

privoxy-regression-test [--check-bad-ssl] [--curl curl] [--debug
bitmask] [--forks forks] [--fuzzer-feeding] [--fuzzer-feeding] [--help]
[--level level] [--local-test-file testfile] [--loops count]
[--max-level max-level] [--max-time max-time] [--min-level min-level]
--privoxy-address proxy-address --privoxy-cgi-prefix cgi-prefix
[--retries retries] [--test-number test-number] [--show-skipped-tests]
[--sleep-time seconds] [--verbose] [--version]

and yes, the synopsis says --loops while the options list says --loop β€” I'm keeping both exactly as the page has them. πŸ’€

πŸ¦‹ DESCRIPTION πŸ¦‹

So Privoxy-Regression-Test is supposed to one day become a regression test suite for Privoxy. It's not quite there yet, however, and can currently only test header actions, check the returned status code for requests to arbitrary URLs and verify which actions are applied to them. It's giving "promising little icon still loading." 🌱

Client header actions are tested by requesting http://p.p/show-request and checking whether or not Privoxy modified the original request as expected.

The original request contains both the header the action-to-be-tested acts upon and an additional tagger-triggering header that enables the action to test.

Applied actions are checked through http://p.p/show-url-info.

🌸 CONFIGURATION FILE SYNTAX 🌸

Privoxy-Regression-Test's configuration is embedded in Privoxy action files and loaded through Privoxy's web interface.

It makes testing a Privoxy version running on a remote system easier and should prevent you from updating your tests without updating Privoxy's configuration accordingly. lowkey thoughtful.

A client-header-action test section looks like this:

# Set Header    = Referer: http://www.example.org.zwiebelsuppe.exit/
# Expect Header = Referer: http://www.example.org/
{+client-header-filter{hide-tor-exit-notation} -hide-referer}
TAG:^client-header-filter\{hide-tor-exit-notation\}$

The example above causes Privoxy-Regression-Test to set the header Referer: http://www.example.org.zwiebelsuppe.exit/ and to expect it to be modified to Referer: http://www.example.org/.

When testing this section, Privoxy-Regression-Test will set the header X-Privoxy-Control: client-header-filter{hide-tor-exit-notation} causing the privoxy-control tagger to create the tag client-header-filter{hide-tor-exit-notation} which will finally cause Privoxy to enable the action section.

πŸ’‘ note bestie: the actions themselves are only used by Privoxy, Privoxy-Regression-Test ignores them and will be happy as long as the expectations are satisfied.

A fetch test looks like this:

# Fetch Test = http://p.p/user-manual
# Expect Status Code = 302

It tells Privoxy-Regression-Test to request http://p.p/user-manual and to expect a response with the HTTP status code 302. Obviously that's not a very thorough test and mainly useful to get some code coverage for Valgrind or to verify that the templates are installed correctly. slay for coverage, I guess. πŸŽ€

If you want to test CGI pages that require a trusted referer, you can use:

# Trusted CGI Request = http://p.p/edit-actions

It works like ordinary fetch tests, but sets the referer header to a trusted value.

If no explicit status code expectation is set, 200 is used.

To verify that a URL is blocked, use:

# Blocked URL = http://www.example.com/blocked

To verify that a specific set of actions is applied to an URL, use:

# Sticky Actions = +block{foo} +handle-as-empty-document -handle-as-image
# URL = http://www.example.org/my-first-url

The sticky actions will be checked for all URLs below it until the next sticky actions directive.

To verify that requests for a URL get redirected, use:

# Redirected URL = http://www.example.com/redirect-me
# Redirect Destination = http://www.example.org/redirected

To skip a test, add the following line:

# Ignore = Yes

The difference between a skipped test and a removed one is that removing a test affects the numbers of the following tests, while a skipped test is still loaded and thus keeps the test numbers unchanged. no cap, numbering is sacred. πŸ”’

Sometimes user modifications intentionally conflict with tests in the default configuration and thus cause test failures. Adding the Ignore directive to the failing tests works but is inconvenient as the directive is likely to get lost with the next update.

Overwrite conditions are an alternative and can be added in any action file as long as they come after the test that is expected to fail. They cause all previous tests that match the condition to be skipped.

It is recommended to put the overwrite condition below the custom Privoxy section that causes the expected test failure and before the custom test that verifies the now expected behaviour. Example:

# The following section is expected to overwrite a section in
# default.action, whose effect is being tested. Thus also disable
# the test that is now expected to fail and add a new one.
#
{+block{Facebook makes Firefox even more unstable. Do not want.}}
# Overwrite condition = http://apps.facebook.com/onthefarm/track.php?creative=&cat=friendvisit&subcat=weeds&key=a789a971dc687bee4c20c044834fabdd&next=index.php%3Fref%3Dnotif%26visitId%3D898835505
# Blocked URL = http://apps.facebook.com/
.facebook./

πŸ‘‘ TEST LEVELS πŸ‘‘

All tests have test levels to let the user control which ones to execute (see OPTIONS below). Test levels are either set with the Level directive, or implicitly through the test type.

Redirect tests default to level 108, block tests to level 7, fetch tests to level 6, "Sticky Actions" tests default to level 5, tests for trusted CGI requests to level 3 and client-header-action tests to level 1.

⚠️ heads up: the current redirect test level is above the default max-level value as failed tests will result in outgoing connections. Use the --max-level option to run them as well. fr fr, read that one twice.

The "Default level offset" directive can be used to change the default level by a given value. This directive affects all tests located after it until the end of the file or another "Default level offset" directive is reached. The purpose of this directive is to make it more convenient to skip similar tests in a given file without having to remove or disable the tests completely.

πŸ’… OPTIONS πŸ’…

  • --check-bad-ssl β€” Instead of running the regression tests as described above, request pages from badssl.com with bad certificates to verify that Privoxy is detecting the certificate issues. Only works if Privoxy has been compiled with FEATURE_HTTPS_INSPECTION, has been configured properly and can reach the Internet.
  • --curl curl β€” Use a non-default curl binary.
  • --debug bitmask β€” Add the bitmask provided as integer to the debug settings.
  • --forks forks β€” Number of forks to start before executing the regression tests. This is mainly useful for stress-testing.
  • --fuzzer-address β€” Listening address used when executing the regression tests. Useful to make sure that the requests to load the regression tests don't fail due to fuzzing.
  • --fuzzer-feeding β€” Ignore some errors that would otherwise cause Privoxy-Regression-Test to abort the test because they shouldn't happen in normal operation. This option is intended to be used if Privoxy-Regression-Test is only used to feed a fuzzer in which case there's a high chance that Privoxy gets an invalid request and returns an error message.
  • --help β€” Shows available command line options.
  • --header-fuzzing β€” Modifies linear white space in headers in a way that should not affect the test result.
  • --level level β€” Only execute tests with the specified level.
  • --local-test-file test-file β€” Do not get the tests through Privoxy's web interface, but use a single local file. Not recommended for testing Privoxy, but can be useful to "misappropriate" Privoxy-Regression-Test to test other stuff, like webserver configurations.
  • --loop count β€” Loop through the regression tests count times. Useful to feed a fuzzer, or when doing stress tests with several Privoxy-Regression-Test instances running at the same time.
  • --max-level max-level β€” Only execute tests with a level below or equal to the numerical max-level.
  • --max-time max-time β€” Give Privoxy max-time seconds to return data. Increasing the default may make sense when Privoxy is run through Valgrind, decreasing the default may make sense when Privoxy-Regression-Test is used to feed a fuzzer.
  • --min-level min-level β€” Only execute tests with a level above or equal to the numerical min-level. If the min-level is larger than the max-level, the max-level is set to the min-level.
  • --privoxy-address proxy-address β€” Privoxy's listening address. If it's not set, the value of the environment variable http_proxy will be used unless the variable isn't set in which case http://127.0.0.1:8118/ will be used. proxy-address has to be specified in http_proxy syntax.
  • --privoxy-cgi-prefix privoxy-cgi-prefix β€” The prefix to use when building URLs that are supposed to reach Privoxy's CGI interface. If it's not set, http://p.p/ is used, which is supposed to work with the default Privoxy configuration. If Privoxy has been built with FEATURE_HTTPS_INSPECTION enabled, and if https inspection is activated with the +https-inspection action, this option can be used with https://p.p/ provided the system running Privoxy-Regression-Test has been configured to trust the certificate used by Privoxy. Note that there are currently two tests in the official regression-tests.action file that are expected to fail when using a privoxy-cgi-prefix with https:// and aren't automatically skipped.
  • --retries retries β€” Retry retries times.
  • --test-number test-number β€” Only run the test with the specified number.
  • --show-skipped-tests β€” Log skipped tests even if verbose mode is off.
  • --shuffle-tests β€” Shuffle test sections and their tests before executing them. When combined with --forks, this can increase the chances of detecting race conditions. Of course some problems are easier to detect without this option.
  • --sleep-time seconds β€” Wait seconds between tests. Useful when debugging issues with systems that don't log with millisecond precision.
  • --verbose β€” Log successful tests as well. By default only the failures are logged.
  • --version β€” Print version and exit.

The second dash is optional, options can be shortened, as long as there are no ambiguities. πŸ’«

πŸŽ€ PRIVOXY CONFIGURATION πŸŽ€

okay so here's the tea, bestie πŸ’– β€” Privoxy-Regression-Test ships with a file called regression-tests.action, and its whole ~purpose~ is to test all the official client-header modifying actions. It can also be used to verify that the templates and the user manual files actually got installed correctly. lowkey a vibe check for your install ✨

To use it, you gotta copy it into Privoxy's configuration directory, and then reference it in Privoxy's configuration file with this line:

actionsfile regression-tests.action

In general, its tests are supposed to work without changing any other action files β€” unless you already added lots of taggers yourself πŸ™ˆ. If you're using taggers that cause problems, you might have to temporarily disable them for Privoxy's CGI pages. annoying but iconic, we deal.

Some of the regression tests rely on Privoxy features that may be disabled in your configuration πŸ‘€ so like, heads up:

  • Tests with a level below 7 are supposed to work with all Privoxy configurations β€” provided you didn't build with FEATURE_GRACEFUL_TERMINATION.
  • Tests with level 9 require Privoxy to deliver the User Manual πŸ“–
  • Tests with level 12 require the CGI editor to be enabled.

πŸ’€ CAVEATS πŸ’€

Expect the configuration file syntax to change with future releases. fr fr, it's giving "don't get too attached" 😭


🚧 LIMITATIONS 🚧

  • As Privoxy's show-request page only shows client headers, Privoxy-Regression-Test can't use it to test Privoxy actions that modify server headers. ngl that's just how it is 🫠
  • As Privoxy-Regression-Test relies on Privoxy's tag feature to control the actions to test, it currently only works with Privoxy 3.0.7 or later ⭐
  • At the moment Privoxy-Regression-Test fetches Privoxy's configuration page through curl(1) β€” therefore you have to have curl installed, otherwise you won't be able to run Privoxy-Regression-Test in a meaningful way. no curl, no slay πŸ’…

πŸ‘€ SEE ALSO πŸ‘€

privoxy(8) curl(1)


πŸ‘‘ AUTHOR πŸ‘‘

Fabian Keil <fk@fabiankeil.de> β€” periodt, the main character of this manpage 🫢


and that's a wrap bestie πŸ¦‹βœ¨ this page is perl v5.42.2, dated 2026-03-31, and it lives under the PRIVOXY...ION-TEST(1) name in the User Contributed Perl Documentation. go forth and regression-test, ily πŸ’œπŸŽ€πŸŒΈ

πŸ“¦ where this page comes from