diff --git a/lib/rex/proto/http/header.rb b/lib/rex/proto/http/header.rb index aa206fcfa7..dff68ffcf7 100644 --- a/lib/rex/proto/http/header.rb +++ b/lib/rex/proto/http/header.rb @@ -58,12 +58,17 @@ class Packet::Header < Hash # def [](key) begin - if ((rv = self.fetch(key)) == nil) - rv = self.dcase_hash[key.downcase] - end + rv = self.fetch(key) rescue IndexError rv = nil end + if (rv == nil) + begin + rv = self.dcase_hash[key.downcase] + rescue IndexError + rv = nil + end + end return rv end