Header check config/logical-inversion fix
Jost Krieger pointed out that the documentation for the header check called for a config_headers, but the code actually implemented scan_headers. Updated to accept either. Also the condition for actually checking/skipping the headers was inverted. Also whitespace fixes.
This commit is contained in:
parent
660ed14823
commit
73eb9012bd
@ -143,7 +143,9 @@ sub init {
|
|||||||
|
|
||||||
$self->{action} = $args{action} || 'add-header';
|
$self->{action} = $args{action} || 'add-header';
|
||||||
$self->{timeout} = $args{timeout} || 30;
|
$self->{timeout} = $args{timeout} || 30;
|
||||||
$self->{check_headers} = $args{'check-headers'};
|
# scan-headers was the originally documented name for this option, while
|
||||||
|
# check-headers actually implements it, so tolerate both.
|
||||||
|
$self->{check_headers} = $args{'check-headers'} || $args{'scan-headers'};
|
||||||
|
|
||||||
$args{mask} ||= 0x00ffffff;
|
$args{mask} ||= 0x00ffffff;
|
||||||
$self->{mask} = 0;
|
$self->{mask} = 0;
|
||||||
@ -270,19 +272,21 @@ sub lookup_start {
|
|||||||
my @qp_continuations;
|
my @qp_continuations;
|
||||||
|
|
||||||
$transaction->body_resetpos;
|
$transaction->body_resetpos;
|
||||||
while ($self->{check_headers} and $l = $transaction->body_getline) {
|
# if we're not looking for URIs in the headers, read past that point
|
||||||
|
# before starting to actually look for any
|
||||||
|
while (!$self->{check_headers} and $l = $transaction->body_getline) {
|
||||||
chomp $l;
|
chomp $l;
|
||||||
last if !$l;
|
last if !$l;
|
||||||
}
|
}
|
||||||
while ($l = $transaction->body_getline) {
|
while ($l = $transaction->body_getline) {
|
||||||
chomp $l;
|
chomp $l;
|
||||||
|
|
||||||
if ($l =~ /(.*)=$/) {
|
if ($l =~ /(.*)=$/) {
|
||||||
push @qp_continuations, $1;
|
push @qp_continuations, $1;
|
||||||
} elsif (@qp_continuations) {
|
} elsif (@qp_continuations) {
|
||||||
$l = join('', @qp_continuations, $l);
|
$l = join('', @qp_continuations, $l);
|
||||||
@qp_continuations = ();
|
@qp_continuations = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
# Undo URI escape munging
|
# Undo URI escape munging
|
||||||
$l =~ s/[=%]([0-9A-Fa-f]{2,2})/chr(hex($1))/ge;
|
$l =~ s/[=%]([0-9A-Fa-f]{2,2})/chr(hex($1))/ge;
|
||||||
|
Loading…
Reference in New Issue
Block a user