use Getopt::Long;
use constant {
- PRT_VERSION => 'Privoxy-Regression-Test 0.7.1',
+ PRT_VERSION => 'Privoxy-Regression-Test 0.7.2',
CURL => 'curl',
sub check_for_forbidden_characters($) {
my $string = shift;
- my $allowed = '[-=\dA-Za-z~{}\[\]:./();\t ,+@"_%?&*^]';
+ my $allowed = '[-=\dA-Za-z~{}\[\]:./();\t ,+@"_%?&*^|]';
unless ($string =~ m/^$allowed*$/o) {
my $forbidden = $string;
sub execute_method_test($) {
my $test = shift;
+ our $privoxy_cgi_url;
+
my $buffer_ref;
my $status_code;
my $method = $test->{'data'};
# Don't complain about the 'missing' body
$curl_parameters .= '--head ' if ($method =~ /^HEAD$/i);
- $curl_parameters .= PRIVOXY_CGI_URL;
+ $curl_parameters .= $privoxy_cgi_url;
$buffer_ref = get_page_with_curl($curl_parameters);
$status_code = get_status_code($buffer_ref);
sub execute_dumb_fetch_test($) {
my $test = shift;
+ our $privoxy_cgi_url;
+
my $buffer_ref;
my $status_code;
$curl_parameters .= '--request ' . quote($test->{method}) . ' ';
}
if ($test->{type} == TRUSTED_CGI_REQUEST) {
- $curl_parameters .= '--referer ' . quote(PRIVOXY_CGI_URL) . ' ';
+ $curl_parameters .= '--referer ' . quote($privoxy_cgi_url) . ' ';
}
$curl_parameters .= quote($test->{'data'});
sub get_final_results($) {
my $url = shift;
+ our $privoxy_cgi_url;
+
my $curl_parameters = '';
my %final_results = ();
my $final_results_reached = 0;
$url =~ s@:@%3A@g;
$url =~ s@/@%2F@g;
- $curl_parameters .= quote(PRIVOXY_CGI_URL . 'show-url-info?url=' . $url);
+ $curl_parameters .= quote($privoxy_cgi_url . 'show-url-info?url=' . $url);
foreach (@{get_cgi_page_or_else($curl_parameters)}) {
if (200 != $status_code) {
- my $log_message = "Failed to fetch Privoxy CGI Page. " .
+ my $log_message = "Failed to fetch Privoxy CGI page '$cgi_url'. " .
"Received status code ". $status_code .
" while only 200 is acceptable.";
sub help() {
our %cli_options;
+ our $privoxy_cgi_url;
print_version();
[--max-time $cli_options{'max-time'}]
[--min-level $cli_options{'min-level'}]
[--privoxy-address]
+ [--privoxy-cgi-prefix $privoxy_cgi_url]
[--retries $cli_options{'retries'}]
[--show-skipped-tests]
[--shuffle-tests]
our %cli_options;
our $log_level;
+ our $privoxy_cgi_url;
init_cli_options();
'max-time=i' => \$cli_options{'max-time'},
'min-level=i' => \$cli_options{'min-level'},
'privoxy-address=s' => \$cli_options{'privoxy-address'},
+ 'privoxy-cgi-prefix=s' => \$privoxy_cgi_url, # XXX: Should use cli_options()
'retries=i' => \$cli_options{'retries'},
'shuffle-tests' => \$cli_options{'shuffle-tests'},
'show-skipped-tests' => \$cli_options{'show-skipped-tests'},
[B<--fuzzer-feeding>] [B<--fuzzer-feeding>] [B<--help>] [B<--level level>]
[B<--local-test-file testfile>] [B<--loops count>] [B<--max-level max-level>]
[B<--max-time max-time>] [B<--min-level min-level>] B<--privoxy-address proxy-address>
-[B<--retries retries>] [B<--test-number test-number>]
+B<--privoxy-cgi-prefix cgi-prefix> [B<--retries retries>] [B<--test-number test-number>]
[B<--show-skipped-tests>] [B<--sleep-time> seconds] [B<--verbose>]
[B<--version>]
will be used. B<proxy-address> has to be specified in http_proxy
syntax.
+B<--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, B<http://p.p/> is used, which is supposed to work
+with the default Privoxy configuration.
+If Privoxy has been built with B<FEATURE_HTTPS_INSPECTION> enabled,
+and if https inspection is activated with the B<+https-inspection>
+action, this option can be used with
+B<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
+B<regression-tests.action> file that are expected to fail when
+using a B<privoxy-cgi-prefix> with B<https://> and aren't automatically
+skipped.
+
B<--retries retries> Retry B<retries> times.
B<--test-number test-number> Only run the test with the specified