From: Eric Wong Date: Fri, 31 Oct 2025 20:35:06 +0000 (+0000) Subject: http: skip and improve warning on undef header values X-Git-Tag: v2.0.0~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca4c12412ad379341965f0d954c8ae7fdb59739f;p=thirdparty%2Fpublic-inbox.git http: skip and improve warning on undef header values In case we see undefined header values again, add some additional information about the request to help track down the problem. This ought to help admins (such as myself) who lack space for more verbose access logs but keep syslog (stderr) logs around longer. --- diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index d61b89511..0ed379f96 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -184,7 +184,10 @@ sub response_write { for (my $i = 0; $i < @$headers; $i += 2) { my $k = $headers->[$i]; - my $v = $headers->[$i + 1]; + my $v = $headers->[$i + 1] // do { + warn "@$env{qw(REQUEST_METHOD REQUEST_URI)} $k undef"; + next; + }; next if $k =~ /\A(?:Connection|Date)\z/i; $len = $v if $k =~ /\AContent-Length\z/i;