Skip to content
Myr

loosen URL handling for non-native URL schemes

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Jayson Vantuyl · committed by Jayson Vantuyl · parent a123f83 · Browse files · 3 files+18 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+18 added−0 removed

  • other:+18 added−0 removed

3 files+18 added−0 removed

modified:requests/models.py+5 added
318 unmodified lines
319 url = str(url)320 except UnicodeDecodeError:321 pass322323 # Don't do any URL preparation for oddball schemes324 if ':' in url and not url.lower().startswith('http'):325 self.url = url326 return327328 # Support for unicode domain names and paths.329 scheme, auth, host, port, path, query, fragment = parse_url(url)330331 if not scheme:
408 unmodified lines
modified:AUTHORS.rst+1 added
139 unmodified lines
140- Matt Spitz @mattspitz141- Vikram Oberoi @voberoi142- Can Ibanoglu <can.ibanoglu@gmail.com> @canibanoglu143- Thomas Weißschuh <thomas@t-8ch.de> @t-8ch144- Jayson Vantuyl <jayson@aggressive.ly> @kagato
modified:test_requests.py+12 added
681 unmodified lines
682 p = req.prepare()683684 assert p.headers['Content-Length'] == length685686 def test_oddball_schemes_dont_check_URLs(self):687 test_urls = (688 'data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUAAAAALAAAAAABAAEAAAICRAEAOw==',689 'file:///etc/passwd',690 'magnet:?xt=urn:btih:be08f00302bc2d1d3cfa3af02024fa647a271431',691 )692 for test_url in test_urls:693 req = requests.Request('GET', test_url)694 preq = req.prepare()695 assert test_url == preq.url696697698class TestContentEncodingDetection(unittest.TestCase):699700 def test_none(self):701 encodings = requests.utils.get_encodings_from_content('')
201 unmodified lines