diff options
author | Eric Wong <normalperson@yhbt.net> | 2013-10-18 18:03:51 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2013-10-18 18:03:51 +0000 |
commit | 3555fdce0c9cf9bb6860a79fdc6843a1e96c9888 (patch) | |
tree | 294bea65cd10359ec3acfd8435db414da595da11 /lib/yahns/http_response.rb | |
parent | 32998f5d56ada5968139cec91cea289e6ffa52bb (diff) | |
download | yahns-3555fdce0c9cf9bb6860a79fdc6843a1e96c9888.tar.gz |
Some users may wish to disable persistent connections for testing or whatever reason, let them. We'll also be using this feature to force SIGQUIT to expire clients.
Diffstat (limited to 'lib/yahns/http_response.rb')
-rw-r--r-- | lib/yahns/http_response.rb | 7 |
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 |