From a6e410b7f85f22e6adbc55eb9dd3a494ca7200b2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 30 Aug 2009 22:27:25 -0700 Subject: ext: ensure headers#each in response is valid We're not Rack::Lint, but we still need to take steps to avoid segfaulting if we host non-Rack::Lint-compliant applications. This also updates the pure variant to fail on bad applications, too. --- lib/clogger/pure.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/clogger/pure.rb') diff --git a/lib/clogger/pure.rb b/lib/clogger/pure.rb index f593af0..0a7aa24 100644 --- a/lib/clogger/pure.rb +++ b/lib/clogger/pure.rb @@ -133,7 +133,12 @@ private end def get_sent_header(headers, match) - headers.each { |key, value| match == key.downcase and return value } + headers.each do |pair| + Array === pair && pair.size >= 2 or + raise TypeError, "headers not returning pairs" + key, value = pair + match == key.downcase and return value + end "-" end -- cgit v1.2.3-24-ge0c7