'Get the Content-Type of the given url, using a HEAD request'

@staticmethod
def _get_content_type(url, session=None):

    if (session is None):
        session = PipSession()
    (scheme, netloc, path, query, fragment) = urlparse.urlsplit(url)
    if (not (scheme in ('http', 'https', 'ftp', 'ftps'))):
        return ''
    resp = session.head(url, allow_redirects=True)
    resp.raise_for_status()
    return resp.headers.get('Content-Type', '')
