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.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/test_proxy_pass.rb b/test/test_proxy_pass.rb
index 448e480..c938976 100644
--- a/test/test_proxy_pass.rb
+++ b/test/test_proxy_pass.rb
@@ -586,6 +586,21 @@ class TestProxyPass < Testcase
       assert_match %r{\AHTTP/1\.1 200 OK\r\n}, res
       assert_match %r{\r\n\r\neof-body-slow\z}, res
       s.close
+
+      # we auto-chunk on 1.1 requests and 1.0 backends
+      %w(eof-body-slow eof-body-fast).each do |x|
+        s = TCPSocket.new(host, port)
+        s.write("GET /#{x} HTTP/1.1\r\nHost: example.com\r\n\r\n")
+        res = ''.dup
+        res << s.readpartial(512) until res =~ /0\r\n\r\n\z/
+        s.close
+        head, body = res.split("\r\n\r\n", 2)
+        head = head.split("\r\n")
+        assert_equal 'HTTP/1.1 200 OK', head[0]
+        assert head.include?('Connection: keep-alive')
+        assert head.include?('Transfer-Encoding: chunked')
+        assert_match %r{\Ad\r\n#{x}\r\n0\r\n\r\n\z}, body
+      end
     end
   end