1 --- misc/Python-2.6.1/Lib/urllib.py 2008-09-21 23:27:51.000000000 +0200
2 +++ misc/build/Python-2.6.1/Lib/urllib.py 2010-11-23 15:41:08.000000000 +0100
3 @@ -176,6 +176,9 @@ class URLopener:
4 def open(self, fullurl, data=None):
5 """Use URLopener().open(file) instead of open(file, 'r')."""
6 fullurl = unwrap(toBytes(fullurl))
7 + # percent encode url. fixing lame server errors like space within url
9 + fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|")
10 if self.tempcache and fullurl in self.tempcache:
11 filename, headers = self.tempcache[fullurl]
12 fp = open(filename, 'rb')
13 @@ -233,41 +236,45 @@ class URLopener:
16 fp = self.open(url, data)
19 - tfp = open(filename, 'wb')
22 - garbage, path = splittype(url)
23 - garbage, path = splithost(path or "")
24 - path, garbage = splitquery(path or "")
25 - path, garbage = splitattr(path or "")
26 - suffix = os.path.splitext(path)[1]
27 - (fd, filename) = tempfile.mkstemp(suffix)
28 - self.__tempfiles.append(filename)
29 - tfp = os.fdopen(fd, 'wb')
30 - result = filename, headers
31 - if self.tempcache is not None:
32 - self.tempcache[url] = result
38 - if "content-length" in headers:
39 - size = int(headers["Content-Length"])
40 - reporthook(blocknum, bs, size)
49 - reporthook(blocknum, bs, size)
55 + tfp = open(filename, 'wb')
58 + garbage, path = splittype(url)
59 + garbage, path = splithost(path or "")
60 + path, garbage = splitquery(path or "")
61 + path, garbage = splitattr(path or "")
62 + suffix = os.path.splitext(path)[1]
63 + (fd, filename) = tempfile.mkstemp(suffix)
64 + self.__tempfiles.append(filename)
65 + tfp = os.fdopen(fd, 'wb')
67 + result = filename, headers
68 + if self.tempcache is not None:
69 + self.tempcache[url] = result
75 + if "content-length" in headers:
76 + size = int(headers["Content-Length"])
77 + reporthook(blocknum, bs, size)
86 + reporthook(blocknum, bs, size)