def getHostHeader(url):
 retVal = url
 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

def getHostHeader ( url ) : retVal = url 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
returns proper host header value for a given target url .