diff --git a/requests/models.py b/requests/models.py index 03ff627adf..bbf08c8135 100644 --- a/requests/models.py +++ b/requests/models.py @@ -334,7 +334,9 @@ def prepare_url(self, url, params): except UnicodeDecodeError: pass - # Don't do any URL preparation for oddball schemes + # Don't do any URL preparation for non-HTTP schemes like `mailto`, + # `data` etc to work around exceptions from `url_parse`, which + # handles RFC 3986 only. if ':' in url and not url.lower().startswith('http'): self.url = url return diff --git a/test_requests.py b/test_requests.py index 9f75a9d9e9..4fccc3468a 100755 --- a/test_requests.py +++ b/test_requests.py @@ -922,7 +922,7 @@ def test_autoset_header_values_are_native(self): assert p.headers['Content-Length'] == length - def test_oddball_schemes_dont_check_URLs(self): + def test_nonhttp_schemes_dont_check_URLs(self): test_urls = ( 'data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUAAAAALAAAAAABAAEAAAICRAEAOw==', 'file:///etc/passwd',