]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
http: skip and improve warning on undef header values
authorEric Wong <e@80x24.org>
Fri, 31 Oct 2025 20:35:06 +0000 (20:35 +0000)
committerEric Wong <e@80x24.org>
Sun, 2 Nov 2025 19:52:22 +0000 (19:52 +0000)
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.

lib/PublicInbox/HTTP.pm

index d61b89511f64d4e252c3679634f81017b1e00434..0ed379f966eafb04b46c749dc9e5f901fd665891 100644 (file)
@@ -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;