about summary refs log tree commit homepage
path: root/test/test_proxy_pass.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_proxy_pass.rb')
-rw-r--r--test/test_proxy_pass.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/test_proxy_pass.rb b/test/test_proxy_pass.rb
index e4e97d1..eb866b3 100644
--- a/test/test_proxy_pass.rb
+++ b/test/test_proxy_pass.rb
@@ -65,6 +65,16 @@ class TestProxyPass < Testcase
           io = env['rack.hijack'].call
           io.write(TRUNCATE_BODY)
           io.close
+        when '/eof-body-fast'
+          io = env['rack.hijack'].call
+          io.write("HTTP/1.0 200 OK\r\n\r\neof-body-fast")
+          io.close
+        when '/eof-body-slow'
+          io = env['rack.hijack'].call
+          io.write("HTTP/1.0 200 OK\r\n\r\n")
+          sleep 0.1
+          io.write("eof-body-slow")
+          io.close
         when '/truncate-head'
           io = env['rack.hijack'].call
           io.write(TRUNCATE_HEAD)
@@ -244,6 +254,7 @@ class TestProxyPass < Testcase
       end
     end
 
+    check_eof_body(host, port)
     check_pipelining(host, port)
     check_response_trailer(host, port)
 
@@ -531,4 +542,22 @@ class TestProxyPass < Testcase
     end
     thrs.each { |t| assert_equal(:OK, t.value) }
   end
+
+  def check_eof_body(host, port)
+    Timeout.timeout(60) do
+      s = TCPSocket.new(host, port)
+      s.write("GET /eof-body-fast HTTP/1.0\r\n\r\n")
+      res = s.read
+      assert_match %r{\AHTTP/1\.1 200 OK\r\n}, res
+      assert_match %r{\r\n\r\neof-body-fast\z}, res
+      s.close
+
+      s = TCPSocket.new(host, port)
+      s.write("GET /eof-body-slow HTTP/1.0\r\n\r\n")
+      res = s.read
+      assert_match %r{\AHTTP/1\.1 200 OK\r\n}, res
+      assert_match %r{\r\n\r\neof-body-slow\z}, res
+      s.close
+    end
+  end
 end