From af9407e7b0a3961a286c8db8a67191c21d90df5f Mon Sep 17 00:00:00 2001 From: HD Moore Date: Sun, 6 Jan 2008 20:06:39 +0000 Subject: [PATCH] Fixes #173. Handle mixed-case header lookups better git-svn-id: file:///home/svn/framework3/trunk@5271 4d416f70-5f16-0410-b530-b9f4589650da --- lib/rex/proto/http/header.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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