X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=tools%2Fprivoxy-regression-test.pl;h=4c305a35fb404981bee12e119430ffaacb9b2086;hp=4288e46d3cf03099d884155ad04542d64d5e7faf;hb=ad4ac0a4b5c0b533b3df903943ba2cbd05126021;hpb=932a2f2791bec30ca40faf35b16e80da6585bc37 diff --git a/tools/privoxy-regression-test.pl b/tools/privoxy-regression-test.pl index 4288e46d..4c305a35 100755 --- a/tools/privoxy-regression-test.pl +++ b/tools/privoxy-regression-test.pl @@ -38,7 +38,7 @@ use strict; use Getopt::Long; use constant { - PRT_VERSION => 'Privoxy-Regression-Test 0.7.1', + PRT_VERSION => 'Privoxy-Regression-Test 0.7.2', CURL => 'curl', @@ -132,7 +132,7 @@ sub parse_tag($) { 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; @@ -1299,10 +1299,20 @@ sub get_server_header($$) { sub get_status_code($) { my $buffer_ref = shift; + our $privoxy_cgi_url; + + my $skip_connection_established_response = $privoxy_cgi_url =~ m@^https://@; my @buffer = @{$buffer_ref}; foreach (@buffer) { + if ($skip_connection_established_response) { + + next if (m@^HTTP/1\.1 200 Connection established@); + next if (m@^\r\n$@); + $skip_connection_established_response = 0; + } + if (/^HTTP\/\d\.\d (\d{3})/) { return $1; @@ -1370,7 +1380,7 @@ sub get_cgi_page_or_else($) { 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."; @@ -1403,8 +1413,13 @@ sub get_show_request_with_curl($) { # Enable the action to test $curl_parameters .= '-H \'X-Privoxy-Control: ' . $test->{'tag'} . '\' '; - # The header to filter - $curl_parameters .= '-H \'' . $header . '\' '; + + # Add the header to filter + if ($privoxy_cgi_url =~ m@^https://@ and $header =~ m@^Host:@) { + $curl_parameters .= '--proxy-header \'' . $header . '\' '; + } else { + $curl_parameters .= '-H \'' . $header . '\' '; + } $curl_parameters .= ' '; $curl_parameters .= $privoxy_cgi_url; @@ -1668,6 +1683,7 @@ sub list_test_types() { sub help() { our %cli_options; + our $privoxy_cgi_url; print_version(); @@ -1687,6 +1703,7 @@ Options and their default values if they have any: [--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] @@ -1727,6 +1744,7 @@ sub parse_cli_options() { our %cli_options; our $log_level; + our $privoxy_cgi_url; init_cli_options(); @@ -1744,6 +1762,7 @@ sub parse_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'}, @@ -1827,7 +1846,7 @@ B [B<--debug bitmask>] [B<--forks> forks] [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>] @@ -2026,6 +2045,20 @@ If it's not set, the value of the environment variable http_proxy will be used. B 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 is used, which is supposed to work +with the default Privoxy configuration. +If Privoxy has been built with B enabled, +and if https inspection is activated with the B<+https-inspection> +action, this option can be used with +B 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 file that are expected to fail when +using a B with B and aren't automatically +skipped. + B<--retries retries> Retry B times. B<--test-number test-number> Only run the test with the specified