Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2017-06-20.16:13:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1497975187.86.0.18522665354.issue30713@psf.upfronthosting.co.za>
In-reply-to
Content
I tried to be more strict, and I was bitten by tests: test_urllib fails on splittype("data:...") where (...) contains newlines characters. One example:

======================================================================

ERROR: test_read_text_base64 (test.test_urllib.urlopen_DataTests)

----------------------------------------------------------------------

Traceback (most recent call last):

  File "/home/travis/build/python/cpython/Lib/test/test_urllib.py", line 511, in setUp

    self.image_url_resp = urllib.request.urlopen(self.image_url)

  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 222, in urlopen

    return opener.open(url, data, timeout)

  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 510, in open

    req = Request(fullurl, data)

  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 328, in __init__

    self.full_url = url

  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 354, in full_url

    self._parse()

  File "/home/travis/build/python/cpython/Lib/urllib/request.py", line 383, in _parse

    raise ValueError("unknown url type: %r" % self.full_url)

ValueError: unknown url type: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAIAAAB7\nQOjdAAAAAXNSR0IArs4c6QAAAA9JREFUCNdj%0AYGBg%2BP//PwAGAQL%2BCm8 vHgAAAABJRU5ErkJggg%3D%3D%0A%20'


I modified splittype() to reject newlines before the type, but accept them after the type.
History
Date User Action Args
2017-06-20 16:13:07vstinnersetrecipients: + vstinner, serhiy.storchaka
2017-06-20 16:13:07vstinnersetmessageid: <1497975187.86.0.18522665354.issue30713@psf.upfronthosting.co.za>
2017-06-20 16:13:07vstinnerlinkissue30713 messages
2017-06-20 16:13:07vstinnercreate