diff options
author | Eric Wong <normalperson@yhbt.net> | 2009-08-29 13:39:58 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2009-08-29 13:40:05 -0700 |
commit | 4cae518fd0b2ba81114ed4cc26eb1704a1f71e28 (patch) | |
tree | bacdbf5c3d8dffbeb81db74651742e42e3519618 /lib | |
parent | c03045ecde0f3270d7458ba7ac0d76a25afc6fb2 (diff) | |
download | clogger-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')
-rw-r--r-- | lib/clogger/pure.rb | 7 |
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 |