about summary refs log tree commit homepage
path: root/test/test_proxy_pass_no_buffering.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-06 03:06:29 +0000
committerEric Wong <e@80x24.org>2016-06-06 05:05:03 +0000
commit8bd2ce70d04414d147639ed2e28ac5a40f78595a (patch)
tree343bbe537015aad54d400c2eed2f741de60df8ec /test/test_proxy_pass_no_buffering.rb
parent133523706715b6e95d2bf410886560f21a23b1e8 (diff)
downloadyahns-8bd2ce70d04414d147639ed2e28ac5a40f78595a.tar.gz
OpenSSL can't handle write retries if we append to an existing
string.  Thus we must preserve the same string object upon
retrying.

Do that by utilizing the underlying Wbuf class which could
already handles it transparently using trysendfile.
However, we still avoiding the subtlety of wbuf_close_common
reliance we previously used.

ref: commit 551e670281bea77e727a732ba94275265ccae5f6
("fix output buffering with SSL_write")
Diffstat (limited to 'test/test_proxy_pass_no_buffering.rb')
-rw-r--r--test/test_proxy_pass_no_buffering.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/test_proxy_pass_no_buffering.rb b/test/test_proxy_pass_no_buffering.rb
index 48b8241..b2c8b48 100644
--- a/test/test_proxy_pass_no_buffering.rb
+++ b/test/test_proxy_pass_no_buffering.rb
@@ -79,6 +79,7 @@ class TestProxyPassNoBuffering < Testcase
     req = "GET /giant-body HTTP/1.1\r\nHost: example.com\r\n" \
           "Connection: close\r\n\r\n"
     s.write(req)
+    bufs = []
     sleep 1
     10.times do
       sleep 0.1
@@ -91,10 +92,14 @@ class TestProxyPassNoBuffering < Testcase
         [ deleted1, deleted2 ].each do |ary|
           ary.delete_if { |x| x =~ /\.(?:err|out) \(deleted\)/ }
         end
-        assert_equal 0, deleted1.size, "pid1=#{deleted1.inspect}"
+        assert_equal 1, deleted1.size, "pid1=#{deleted1.inspect}"
         assert_equal 0, deleted2.size, "pid2=#{deleted2.inspect}"
+        bufs.push(deleted1[0])
       end
     end
+    before = bufs.size
+    bufs.uniq!
+    assert bufs.size < before, 'unlinked buffer should not grow'
     buf = ''.dup
     slow = Digest::MD5.new
     ft = Thread.new do