raise MissingSchema("Invalid URL {0!r}: No schema supplied. "
"Perhaps you meant http://{0}?".format(url))
- # Don't do any URL preparation for oddball schemes
- if scheme.lower() not in ('http', 'https'):
- self.url = url
- return
-
if not host:
raise InvalidURL("Invalid URL %r: No host supplied" % url)
# Scheme
if '://' in url:
scheme, url = url.split('://', 1)
- elif ':' in url:
- scheme, url = url.split(':', 1)
# Find the earliest Authority Terminator
# (http://tools.ietf.org/html/rfc3986#section-3.2)
assert p.headers['Content-Length'] == length
- def test_oddball_schemes_dont_check_URLs(self):
- r1 = requests.Request('GET', 'data:image/gif;base64,R0lGODlhAQABAHAAACH5BAUAAAAALAAAAAABAAEAAAICRAEAOw==')
- r1.prepare()
- r2 = requests.Request('GET', 'file:///etc/passwd')
- r2.prepare()
- r3 = requests.Request('GET', 'magnet:?xt=urn:btih:be08f00302bc2d1d3cfa3af02024fa647a271431')
- r3.prepare()
-
class TestContentEncodingDetection(unittest.TestCase):
def test_none(self):