Skip to content

Commit

Permalink
Make sure that url has fragment removed when using a proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
jhalcrow committed Oct 27, 2012
1 parent 6e0ad1e commit 724a388
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions requests/compat.py
Expand Up @@ -84,7 +84,7 @@

if is_py2:
from urllib import quote, unquote, quote_plus, unquote_plus, urlencode
from urlparse import urlparse, urlunparse, urljoin, urlsplit
from urlparse import urlparse, urlunparse, urljoin, urlsplit, urldefrag
from urllib2 import parse_http_list
import cookielib
from Cookie import Morsel
Expand All @@ -104,7 +104,7 @@


elif is_py3:
from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus
from urllib.parse import urlparse, urlunparse, urljoin, urlsplit, urlencode, quote, unquote, quote_plus, unquote_plus, urldefrag
from urllib.request import parse_http_list
from http import cookiejar as cookielib
from http.cookies import Morsel
Expand Down
6 changes: 4 additions & 2 deletions requests/models.py
Expand Up @@ -34,7 +34,7 @@
to_key_val_list, DEFAULT_CA_BUNDLE_PATH, parse_header_links, iter_slices)
from .compat import (
cookielib, urlparse, urlunparse, urljoin, urlsplit, urlencode, str, bytes,
StringIO, is_py2, chardet, json, builtin_str)
StringIO, is_py2, chardet, json, builtin_str, urldefrag)

REDIRECT_STATI = (codes.moved, codes.found, codes.other, codes.temporary_moved)
CONTENT_CHUNK_SIZE = 10 * 1024
Expand Down Expand Up @@ -445,7 +445,9 @@ def path_url(self):

# Proxies use full URLs.
if p.scheme in self.proxies:
return self.full_url
url_base, frag = urldefrag(self.full_url)
return url_base


path = p.path
if not path:
Expand Down

0 comments on commit 724a388

Please sign in to comment.