# A regression test "framework" for Privoxy. For documentation see:
# perldoc privoxy-regression-test.pl
#
-# $Id: privoxy-regression-test.pl,v 1.109 2008/02/15 16:40:04 fk Exp fk $
+# $Id: privoxy-regression-test.pl,v 1.110 2008/02/16 12:55:18 fk Exp fk $
#
# Wish list:
#
}
-
return $result;
}
my $curl_parameters = '';
my $expected_status_code = $test{'expected-status-code'};
- if ($method =~ /HEAD/i) {
-
- $curl_parameters .= '--head ';
-
- } else {
-
- $curl_parameters .= '-X ' . $method . ' ';
- }
+ $curl_parameters .= '--request ' . $method . ' ';
+ # Don't complain in case about the 'missing' body
+ $curl_parameters .= '--head ' if ($method =~ /^HEAD$/i);
$curl_parameters .= PRIVOXY_CGI_URL;
return $result;
}
-
sub execute_dumb_fetch_test ($) {
my $test_ref = shift;
my $expected_status_code = $test{'expected-status-code'};
if (defined $test{method}) {
- $curl_parameters .= '-X ' . $test{method} . ' ';
+ $curl_parameters .= '--request ' . $test{method} . ' ';
}
if ($test{type} == TRUSTED_CGI_REQUEST) {
$curl_parameters .= '--referer ' . PRIVOXY_CGI_URL . ' ';
return $success;
}
-
sub get_header_name ($) {
my $header = shift;
foreach (@buffer) {
- # XXX: shoul probably verify that the request
+ # XXX: should probably verify that the request
# was actually answered by Fellatio.
if (/^$header_to_get/) {
$header = $_;
return $header;
}
-sub get_header_to_check ($) {
-
- # No longer in use but not removed yet.
-
- my $buffer_ref = shift;
- my $header;
- my @buffer = @{$buffer_ref};
- my $line;
- my $processed_request_reached = 0;
- my $read_header = 0;
- my $processed_request = '';
-
- l(LL_ERROR, "You are not supposed to use get_header_to_()!");
-
- foreach (@buffer) {
-
- # Skip everything before the Processed request
- if (/Processed Request/) {
- $processed_request_reached = 1;
- next;
- }
- next unless $processed_request_reached;
-
- # End loop after the Processed request
- last if (/<\/pre>/);
-
- # Ditch tags and leading/trailing white space.
- s@^\s*<.*?>@@g;
- s@\s*$@@g;
-
- $processed_request .= $_;
-
- if (/^X-Privoxy-Regression-Test/) {
- $read_header = 1;
- next;
- }
-
- if ($read_header) {
- $header = $_;
- $read_header = 0;
- }
-
- }
-
- return $header;
-}
-
sub get_status_code ($) {
my $buffer_ref = shift;
$curl_line .= ' --proxy ' . get_cli_option('privoxy-address');
}
+ # We want to see the HTTP status code
+ $curl_line .= " --include ";
# Let Privoxy emit two log messages less.
$curl_line .= ' -H \'Proxy-Connection:\' ' unless $parameters =~ /Proxy-Connection:/;
$curl_line .= ' -H \'Connection: close\' ' unless $parameters =~ /Connection:/;
$curl_line .= " -s ";
# We do care about the failure reason if any.
$curl_line .= " -S ";
- # We want to see the HTTP status code
- $curl_line .= " --include ";
# We want to advertise ourselves
$curl_line .= " --user-agent '" . PRT_VERSION . "' ";
# We aren't too patient