about summary refs log tree commit homepage
path: root/t/write-on-close.ru
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2011-01-05 23:05:05 -0800
committerEric Wong <normalperson@yhbt.net>2011-01-05 23:05:05 -0800
commitb7a0074284d33352bb9e732c660b29162f34bf0e (patch)
tree664d6b3f1f732b597c41f1b48a5f478ce197de71 /t/write-on-close.ru
parent7f3ebe9213e09932cd0e8a2a82bfe2dd5430a824 (diff)
downloadunicorn-b7a0074284d33352bb9e732c660b29162f34bf0e.tar.gz
Response bodies may capture the block passed to each
and save it for body.close, so don't close the socket
before we have a chance to call body.close

(cherry picked from commit b72a86f66c722d56a6d77ed1d2779ace6ad103ed)

Conflicts:

	lib/unicorn/http_server.rb
	test/unit/test_response.rb
Diffstat (limited to 't/write-on-close.ru')
-rw-r--r--t/write-on-close.ru11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/write-on-close.ru b/t/write-on-close.ru
new file mode 100644
index 0000000..54a2f2e
--- /dev/null
+++ b/t/write-on-close.ru
@@ -0,0 +1,11 @@
+class WriteOnClose
+  def each(&block)
+    @callback = block
+  end
+
+  def close
+    @callback.call "7\r\nGoodbye\r\n0\r\n\r\n"
+  end
+end
+use Rack::ContentType, "text/plain"
+run(lambda { |_| [ 200, [%w(Transfer-Encoding chunked)], WriteOnClose.new ] })