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,
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 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;
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.";
# 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;