Fix for an Issue #101

This commit is contained in:
Miroslav Stampar
2012-07-17 00:19:33 +02:00
parent c96e44b30c
commit 81d15e5051
2 changed files with 14 additions and 10 deletions

View File

@@ -3050,12 +3050,15 @@ def getHostHeader(url):
Returns proper Host header value for a given target URL
"""
retVal = urlparse.urlparse(url).netloc
retVal = url
if re.search("http(s)?://\[.+\]", url, re.I):
retVal = extractRegexResult("http(s)?://\[(?P<result>.+)\]", url)
elif any(retVal.endswith(':%d' % _) for _ in (80, 443)):
retVal = retVal.split(':')[0]
if url:
retVal = urlparse.urlparse(url).netloc
if re.search("http(s)?://\[.+\]", url, re.I):
retVal = extractRegexResult("http(s)?://\[(?P<result>.+)\]", url)
elif any(retVal.endswith(':%d' % _) for _ in (80, 443)):
retVal = retVal.split(':')[0]
return retVal