From 8bd2ce70d04414d147639ed2e28ac5a40f78595a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 6 Jun 2016 03:06:29 +0000 Subject: wbuf_lite: fix write retries for OpenSSL sockets 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") --- test/test_proxy_pass_no_buffering.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'test/test_proxy_pass_no_buffering.rb') 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 -- cgit v1.2.3-24-ge0c7