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.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/yahns/http_response.rb b/lib/yahns/http_response.rb
index 99bf664..cbfcf77 100644
--- a/lib/yahns/http_response.rb
+++ b/lib/yahns/http_response.rb
@@ -75,11 +75,11 @@ module Yahns::HttpResponse # :nodoc:
       case rv = wbuf.wbuf_close(self)
       when :ignore # hijacked
         @state = rv
-      when Yahns::StreamFile
-        @state = rv
-        :wait_writable
       when true, false
         http_response_done(rv)
+      else # Yahns::StreamFile
+        @state = rv
+        :wait_writable
       end
     else
       @state = wbuf
@@ -162,9 +162,6 @@ module Yahns::HttpResponse # :nodoc:
       case rv = kgio_syssend(buf, flags)
       when nil # all done, likely
         break
-      when String
-        flags = MSG_DONTWAIT
-        buf = rv # hope the skb grows
       when :wait_writable, :wait_readable
         if k.output_buffering
           alive = hijack ? hijack : alive
@@ -174,6 +171,9 @@ module Yahns::HttpResponse # :nodoc:
         else
           response_wait_write(rv) or return :close
         end
+      else # String
+        flags = MSG_DONTWAIT
+        buf = rv # hope the skb grows
       end while true
     end
 
@@ -192,8 +192,6 @@ module Yahns::HttpResponse # :nodoc:
         case rv = kgio_trywrite(chunk)
         when nil # all done, likely and good!
           break
-        when String
-          chunk = rv # hope the skb grows when we loop into the trywrite
         when :wait_writable, :wait_readable
           if k.output_buffering
             wbuf = Yahns::Wbuf.new(body, alive, k.output_buffer_tmpdir, rv)
@@ -202,6 +200,8 @@ module Yahns::HttpResponse # :nodoc:
           else
             response_wait_write(rv) or return :close
           end
+        else # String
+          chunk = rv # hope the skb grows when we loop into the trywrite
         end while true
       end
     end
@@ -231,8 +231,6 @@ module Yahns::HttpResponse # :nodoc:
         case rv = kgio_trywrite(buf)
         when nil
           break
-        when String
-          buf = rv
         when :wait_writable, :wait_readable
           if self.class.output_buffering
             wbuf = buf.dup
@@ -241,6 +239,8 @@ module Yahns::HttpResponse # :nodoc:
           else
             response_wait_write(rv) or return :close
           end
+        else # String
+          buf = rv
         end while true
       end
     end
@@ -257,8 +257,6 @@ module Yahns::HttpResponse # :nodoc:
                                   : "HTTP/1.1 100 Continue\r\n\r\n".freeze
 
     case rv = kgio_trywrite(buf)
-    when String
-      buf = rv
     when :wait_writable, :wait_readable
       if self.class.output_buffering
         @state = Yahns::WbufStr.new(buf, :r100_done)
@@ -266,8 +264,10 @@ module Yahns::HttpResponse # :nodoc:
       else
         response_wait_write(rv) or return :close
       end
-    else
+    when nil
       return rv
+    else # String
+      buf = rv
     end while true
   end
 end