about summary refs log tree commit homepage
path: root/lib/clogger/pure.rb
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2009-08-29 13:39:58 -0700
committerEric Wong <normalperson@yhbt.net>2009-08-29 13:40:05 -0700
commit4cae518fd0b2ba81114ed4cc26eb1704a1f71e28 (patch)
treebacdbf5c3d8dffbeb81db74651742e42e3519618 /lib/clogger/pure.rb
parentc03045ecde0f3270d7458ba7ac0d76a25afc6fb2 (diff)
downloadclogger-4cae518fd0b2ba81114ed4cc26eb1704a1f71e28.tar.gz
Some misbehaved apps can do this to us, and we don't want
the C extension to segfault when this happens.
Diffstat (limited to 'lib/clogger/pure.rb')
-rw-r--r--lib/clogger/pure.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/clogger/pure.rb b/lib/clogger/pure.rb
index 85c6777..f593af0 100644
--- a/lib/clogger/pure.rb
+++ b/lib/clogger/pure.rb
@@ -16,7 +16,12 @@ class Clogger
 
   def call(env)
     @start = Time.now
-    status, headers, body = @app.call(env)
+    resp = @app.call(env)
+    unless resp.instance_of?(Array) && resp.size == 3
+      log(env, 500, {})
+      raise TypeError, "app response not a 3 element Array: #{resp.inspect}"
+    end
+    status, headers, body = resp
     if wrap_body?
       @reentrant = env['rack.multithread']
       @env, @status, @headers, @body = env, status, headers, body