diff options
author | Eric Wong <e@80x24.org> | 2016-04-30 10:02:06 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2016-04-30 10:02:06 +0000 |
commit | 01a63717093d3b11a57abc92bc77463545189e4c (patch) | |
tree | e395193845a61c2ff66edcecc1dce043a2b0f185 /test/test_proxy_pass.rb | |
parent | 498386c33d162cac11506da694f0355add06be06 (diff) | |
parent | 5a74026b580cefeb95d75db40e1a55cd0be52751 (diff) | |
download | yahns-01a63717093d3b11a57abc92bc77463545189e4c.tar.gz |
* proxy_pass-fix: proxy_pass: drop resources immediately on errors proxy_http_response: do not persist upstream on slow clients proxy_http_response: cleanup: avoid redundant setting of "alive" wbuf: drop persistence if writing to client fails test_proxy_pass: test for auto chunking on 1.0 backends
Diffstat (limited to 'test/test_proxy_pass.rb')
-rw-r--r-- | test/test_proxy_pass.rb | 15 |
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 |