'Parses the URL and rebuilds it to be scheme://host/path.'

def get_normalized_http_url(self):

    parts = urlparse.urlparse(self.http_url)
    query = str(parts[4])
    logging.info(query)
    (scheme, netloc, path) = parts[:3]
    if ((scheme == 'http') and (netloc[(-3):] == ':80')):
        netloc = netloc[:(-3)]
    elif ((scheme == 'https') and (netloc[(-4):] == ':443')):
        netloc = netloc[:(-4)]
    normal = ('%s://%s%s' % (scheme, netloc, path))
    if (len(query) > 0):
        normal = ((normal + '?') + query)
    return normal
