minor lower/upper case fix

This commit is contained in:
Miroslav Stampar 2011-08-29 13:47:32 +00:00
parent 9be89422da
commit 08e0eb9b61
2 changed files with 15 additions and 4 deletions

View File

@ -394,8 +394,12 @@ def start():
# Test Cookie header only if --level >= 2
skip |= (place == PLACE.COOKIE and conf.level < 2)
skip &= not (place == PLACE.UA and intersect(USER_AGENT_ALIASES, conf.testParameter))
skip &= not (place == PLACE.REFERER and intersect(REFERER_ALIASES, conf.testParameter))
skip |= (place == PLACE.UA and intersect(USER_AGENT_ALIASES, conf.skip, True) not in ([], None))
skip |= (place == PLACE.REFERER and intersect(REFERER_ALIASES, conf.skip, True) not in ([], None))
skip |= (place == PLACE.COOKIE and intersect('cookie', conf.skip, True) not in ([], None))
skip &= not (place == PLACE.UA and intersect(USER_AGENT_ALIASES, conf.testParameter, True))
skip &= not (place == PLACE.REFERER and intersect(REFERER_ALIASES, conf.testParameter, True))
if skip:
continue

View File

@ -2679,7 +2679,7 @@ def getExceptionFrameLocals():
return retVal
def intersect(valueA, valueB):
def intersect(valueA, valueB, lowerCase=False):
"""
Returns intersection of the array-ized values
"""
@ -2687,7 +2687,14 @@ def intersect(valueA, valueB):
retVal = None
if valueA and valueB:
retVal = [val for val in arrayizeValue(valueA) if val in arrayizeValue(valueB)]
valueA = arrayizeValue(valueA)
valueB = arrayizeValue(valueB)
if lowerCase:
valueA = [val.lower() if isinstance(val, basestring) else val for val in valueA]
valueB = [val.lower() if isinstance(val, basestring) else val for val in valueB]
retVal = [val for val in valueA if val in valueB]
return retVal