header_ok: Only keep first line of argument
This allows callers to pass the entire response without generating overly long error messages.
This commit is contained in:
parent
b58a10b3e3
commit
adbac91be7
2 changed files with 7 additions and 0 deletions
|
@ -3774,6 +3774,7 @@ sub nic_updateable {
|
||||||
######################################################################
|
######################################################################
|
||||||
sub header_ok {
|
sub header_ok {
|
||||||
my ($host, $line) = @_;
|
my ($host, $line) = @_;
|
||||||
|
$line =~ s/\r?\n.*//s;
|
||||||
my $ok = 0;
|
my $ok = 0;
|
||||||
|
|
||||||
if ($line =~ m%^s*HTTP/.*\s+(\d+)%i) {
|
if ($line =~ m%^s*HTTP/.*\s+(\d+)%i) {
|
||||||
|
|
|
@ -51,6 +51,12 @@ my @test_cases = (
|
||||||
input => 'HTTP/1.1 456 bad',
|
input => 'HTTP/1.1 456 bad',
|
||||||
want => 0,
|
want => 0,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
desc => 'only first line is logged on error',
|
||||||
|
input => "HTTP/1.1 404 not found\n\nbody",
|
||||||
|
want => 0,
|
||||||
|
wantmsg => qr/(?!body)/,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
for my $tc (@test_cases) {
|
for my $tc (@test_cases) {
|
||||||
|
|
Loading…
Reference in a new issue