about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/yahns/http_response.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb
index a31ab70..bde4b3f 100644
--- a/lib/yahns/http_response.rb
+++ b/lib/yahns/http_response.rb
@@ -165,12 +165,12 @@ module Yahns::HttpResponse # :nodoc:
     end
     count ||= clen
 
-    if !term && chunk_ok
+    if !term && chunk_ok && !hdr_only
       term = true
       body = Yahns::ChunkBody.new(body, opt)
       buf << "Transfer-Encoding: chunked\r\n".freeze
     end
-    alive &&= term
+    alive &&= (term || hdr_only)
     buf << (alive ? "Connection: keep-alive\r\n\r\n".freeze
                   : "Connection: close\r\n\r\n".freeze)
     case rv = kgio_syssend(buf, flags)