Skip to content

Commit

Permalink
Faster iget
Browse files Browse the repository at this point in the history
  • Loading branch information
andresriancho committed Jan 27, 2015
1 parent 012d55a commit 0c6fc33
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions w3af/core/data/dc/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
along with w3af; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
"""
import string

from w3af.core.data.constants.encodings import UTF8
from w3af.core.data.dc.generic.nr_kv_container import NonRepeatKeyValueContainer
from w3af.core.data.misc.encoding import smart_unicode
Expand Down Expand Up @@ -103,11 +105,12 @@ def iget(self, header_name, default=None):
:param header_name: The name of the header we want the value for
:return: The value for a header given a name (be case insensitive)
"""
lower_header_name = header_name.lower()

for stored_header_name in self:
if lower_header_name == stored_header_name.lower():
return self[stored_header_name], stored_header_name
lower = string.lower
lower_header_name = lower(header_name)

for stored_header_name, value in self.iteritems():
if lower_header_name == lower(stored_header_name):
return value, stored_header_name

return default, None

Expand Down

0 comments on commit 0c6fc33

Please sign in to comment.