about summary refs log tree commit homepage
path: root/t/hijack.ru
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-06-09 20:17:18 +0000
committerEric Wong <e@80x24.org>2015-06-10 09:18:59 +0000
commit02a072734906ac4c1ea77990207b84895ab4a7cb (patch)
tree04abb7b53211c779637ab5a2f0e2930dbbd2ac6d /t/hijack.ru
parent40b9812029848933037466b2e7b19a47cfbd8363 (diff)
downloadunicorn-02a072734906ac4c1ea77990207b84895ab4a7cb.tar.gz
Middlewares such as Rack::Lock (used by Rails) break badly unless
the response body is closed on hijack, so we will close it to follow
the lead of other popular Rack servers.

While it's unclear if there's anybody using rack.hijack with unicorn,
we'll try to emulate the behavior of other servers as much as
possible.

ref: https://github.com/ngauthier/tubesock/issues/10
Diffstat (limited to 't/hijack.ru')
-rw-r--r--t/hijack.ru3
1 files changed, 2 insertions, 1 deletions
diff --git a/t/hijack.ru b/t/hijack.ru
index fcb0b6d..4adec61 100644
--- a/t/hijack.ru
+++ b/t/hijack.ru
@@ -2,12 +2,13 @@ use Rack::Lint
 use Rack::ContentLength
 use Rack::ContentType, "text/plain"
 class DieIfUsed
+  @@n = 0
   def each
     abort "body.each called after response hijack\n"
   end
 
   def close
-    abort "body.close called after response hijack\n"
+    warn "closed DieIfUsed #{@@n += 1}\n"
   end
 end
 run lambda { |env|