kennethreitz/requests — pull request #912 by jhalcrow (2012-10-27 14:03:56+00:00)
Title: Make sure that url has fragment removed when using a proxy

When making a request that uses a proxy Request.path_url falls back to Request.full_url. However Request.full_url does not strip the fragment from the url, which is improper and will cause some HTTP servers to respond with a 400 error.

This patch modifies Request.path_url to pass full_url through urlparse.urldefrag before returning it when a proxy is being used. It also plumbs urldefrag through the compat module so that I can use it here.

The alternative would be to modify full_url to defrag, but it seems to be used in setting the url for the Response object so I figured it would be better done in here.