]> Sergey Matveev's repositories - public-inbox.git/commitdiff
http: fix condition for detecting persistence
authorEric Wong <e@80x24.org>
Mon, 4 Apr 2016 21:15:26 +0000 (21:15 +0000)
committerEric Wong <e@80x24.org>
Mon, 4 Apr 2016 21:15:45 +0000 (21:15 +0000)
Oops, we need to watch out for how we handle operator
precedence and ensure responses without a Content-Length
or "Transfer-Encoding: chunked" header will always
disconnect after writing.

lib/PublicInbox/HTTP.pm

index a5c56e2573946a1ba179c8d3eb73076585053f43..68c3b7881fc31c435d96d48b6afb0d056204df47 100644 (file)
@@ -169,8 +169,8 @@ sub response_header_write {
 
        my $conn = $env->{HTTP_CONNECTION} || '';
        my $alive = (defined($len) || $chunked) &&
-                       ($proto eq 'HTTP/1.1' && $conn !~ /\bclose\b/i) ||
-                       ($conn =~ /\bkeep-alive\b/i);
+                       (($proto eq 'HTTP/1.1' && $conn !~ /\bclose\b/i) ||
+                        ($conn =~ /\bkeep-alive\b/i));
 
        $h .= 'Connection: ' . ($alive ? 'keep-alive' : 'close');
        $h .= "\r\nDate: " . http_date() . "\r\n\r\n";