about summary refs log tree commit homepage
path: root/lib/yahns/http_response.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns/http_response.rb')
-rw-r--r--lib/yahns/http_response.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb
index 8967670..b6228e5 100644
--- a/lib/yahns/http_response.rb
+++ b/lib/yahns/http_response.rb
@@ -91,7 +91,8 @@ module Yahns::HttpResponse # :nodoc:
     status = CODES[status.to_i] || status
     offset = 0
     count = hijack = nil
-    alive = @hs.next?
+    k = self.class
+    alive = @hs.next? && k.persistent_connections
 
     if @hs.headers?
       buf = "#{response_start}#{status}\r\nDate: #{httpdate}\r\n"
@@ -126,7 +127,7 @@ module Yahns::HttpResponse # :nodoc:
       when String
         buf = rv # hope the skb grows
       when :wait_writable, :wait_readable
-        if self.class.output_buffering
+        if k.output_buffering
           alive = hijack ? hijack : alive
           rv = response_header_blocked(rv, buf, body, alive, offset, count)
           body = nil # ensure we do not close body in ensure
@@ -158,7 +159,7 @@ module Yahns::HttpResponse # :nodoc:
         when String
           chunk = rv # hope the skb grows when we loop into the trywrite
         when :wait_writable, :wait_readable
-          if self.class.output_buffering
+          if k.output_buffering
             wbuf = Yahns::Wbuf.new(body, alive)
             rv = wbuf.wbuf_write(self, chunk)
             break