From: Eric Wong Date: Mon, 4 Apr 2016 21:15:26 +0000 (+0000) Subject: http: fix condition for detecting persistence X-Git-Tag: v1.0.0~625 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a7b196b4e6b27ee10f126a36702a63a5ae787df1;p=public-inbox.git http: fix condition for detecting persistence 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. --- diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index a5c56e25..68c3b788 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -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";