about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-06-05 09:06:55 +0000
committerEric Wong <e@80x24.org>2015-06-05 09:08:38 +0000
commitf1675cca9eedde62d1bcd3db6deca0752c2fecf2 (patch)
tree251d5c88a784a4927c398b2f85caec174e508238 /lib
parent19e1bf7e56201a91e0e0ae7763e5153407392561 (diff)
downloadyahns-f1675cca9eedde62d1bcd3db6deca0752c2fecf2.tar.gz
We don't need to waste a valuable ivar slot on each socket
when we know unicorn already maintains this flag for us.
Diffstat (limited to 'lib')
-rw-r--r--lib/yahns/http_client.rb1
-rw-r--r--lib/yahns/http_response.rb9
2 files changed, 4 insertions, 6 deletions
diff --git a/lib/yahns/http_client.rb b/lib/yahns/http_client.rb
index 620e925..7351171 100644
--- a/lib/yahns/http_client.rb
+++ b/lib/yahns/http_client.rb
@@ -20,7 +20,6 @@ class Yahns::HttpClient < Kgio::Socket # :nodoc:
   # called from acceptor thread
   def yahns_init
     @hs = Unicorn::HttpRequest.new
-    @response_start_sent = false
     @state = :headers # :body, :trailers, :pipelined, Wbuf, StreamFile
     @input = nil
   end
diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb
index 1ef2bbf..1be28bc 100644
--- a/lib/yahns/http_response.rb
+++ b/lib/yahns/http_response.rb
@@ -46,7 +46,7 @@ module Yahns::HttpResponse # :nodoc:
   end
 
   def response_start
-    @response_start_sent ? Z : RESPONSE_START
+    @hs.response_start_sent ? Z : RESPONSE_START
   end
 
   def response_wait_write(rv)
@@ -94,7 +94,6 @@ module Yahns::HttpResponse # :nodoc:
   def http_response_done(alive)
     @input = @input.close if @input
     if alive
-      @response_start_sent = false
       # @hs.buf will have data if the client pipelined
       if @hs.buf.empty?
         @state = :headers
@@ -224,7 +223,7 @@ module Yahns::HttpResponse # :nodoc:
   # returns nil on success
   # :wait_readable/:wait_writable/:close for epoll
   def do_ccc
-    @response_start_sent = true
+    @hs.response_start_sent = true
     wbuf = nil
     rv = nil
     CCC_RESPONSE_START.each do |buf|
@@ -256,8 +255,8 @@ module Yahns::HttpResponse # :nodoc:
   # returns :close, :wait_writable, or :wait_readable
   def http_100_response(env)
     env.delete("HTTP_EXPECT") =~ /\A100-continue\z/i or return
-    buf = @response_start_sent ? "100 Continue\r\n\r\nHTTP/1.1 ".freeze
-                               : "HTTP/1.1 100 Continue\r\n\r\n".freeze
+    buf = @hs.response_start_sent ? "100 Continue\r\n\r\nHTTP/1.1 ".freeze
+                                  : "HTTP/1.1 100 Continue\r\n\r\n".freeze
 
     case rv = kgio_trywrite(buf)
     when String