'Obtain the url to use when making the final request.
If the message is being sent through a proxy, the full URL has to be
used. Otherwise, we should only use the path portion of the URL.'

def request_url(self, request, proxies):

    proxies = (proxies or {})
    proxy = proxies.get(urlparse(request.url).scheme)
    if proxy:
        (url, _) = urldefrag(request.url)
    else:
        url = request.path_url
    return url
