From a7b196b4e6b27ee10f126a36702a63a5ae787df1 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 4 Apr 2016 21:15:26 +0000 Subject: 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. --- lib/PublicInbox/HTTP.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/PublicInbox/HTTP.pm') 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"; -- cgit v1.2.3-24-ge0c7