X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=tools%2Fprivoxy-regression-test.pl;h=5c1a86dcce03c6915b569d924ef73a3ee102e2c7;hb=0d61dc10cef6bd2b0c44452ea828ae0385bd6430;hp=6f342bafc582f06ca09482594f5c520790a238d6;hpb=7fb7e28f2c2b3c45fc856210752f1e652f7132f0;p=privoxy.git diff --git a/tools/privoxy-regression-test.pl b/tools/privoxy-regression-test.pl index 6f342baf..5c1a86dc 100755 --- a/tools/privoxy-regression-test.pl +++ b/tools/privoxy-regression-test.pl @@ -47,11 +47,13 @@ use constant { CLI_LOOPS => 1, CLI_MAX_TIME => 5, CLI_MIN_LEVEL => 0, - # XXX: why limit at all? + # The reason for a maximum test level is explained in the + # perldoc section TEST LEVELS near the end of this file. CLI_MAX_LEVEL => 100, CLI_FORKS => 0, CLI_SLEEP_TIME => 0, + PRIVOXY_ADDRESS => 'http://127.0.0.1:8118/', PRIVOXY_CGI_URL => 'http://p.p/', FELLATIO_URL => 'http://127.0.0.1:8080/', LEADING_LOG_DATE => 1, @@ -89,6 +91,7 @@ sub init_our_variables() { our $leading_log_date = LEADING_LOG_DATE; our $privoxy_cgi_url = PRIVOXY_CGI_URL; our $log_level = get_default_log_level(); + our $proxy = defined $ENV{'http_proxy'} ? $ENV{'http_proxy'} : PRIVOXY_ADDRESS; } sub get_default_log_level() { @@ -132,7 +135,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 +1302,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 +1383,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 +1416,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; @@ -1687,7 +1705,7 @@ Options and their default values if they have any: [--max-level $cli_options{'max-level'}] [--max-time $cli_options{'max-time'}] [--min-level $cli_options{'min-level'}] - [--privoxy-address] + [--privoxy-address $cli_options{'privoxy-address'}] [--privoxy-cgi-prefix $privoxy_cgi_url] [--retries $cli_options{'retries'}] [--show-skipped-tests] @@ -1714,6 +1732,7 @@ sub init_cli_options() { our %cli_options; our $log_level; + our $proxy; $cli_options{'debug'} = $log_level; $cli_options{'forks'} = CLI_FORKS; @@ -1723,6 +1742,7 @@ sub init_cli_options() { $cli_options{'min-level'} = CLI_MIN_LEVEL; $cli_options{'sleep-time'}= CLI_SLEEP_TIME; $cli_options{'retries'} = CLI_RETRIES; + $cli_options{'privoxy-address'} = $proxy; } sub parse_cli_options() { @@ -2027,8 +2047,9 @@ above or equal to the numerical B. B<--privoxy-address proxy-address> Privoxy's listening address. 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. +will be used unless the variable isn't set in which case +http://127.0.0.1:8118/ 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.