diff options
| -rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 16 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 18 |
2 files changed, 23 insertions, 11 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index d9d193ab12..05999607b9 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
| @@ -208,6 +208,10 @@ class URI(object): | |||
| 208 | if not uri: | 208 | if not uri: |
| 209 | return | 209 | return |
| 210 | 210 | ||
| 211 | # We hijack the URL parameters, since the way bitbake uses | ||
| 212 | # them are not quite RFC compliant. | ||
| 213 | uri, param_str = (uri.split(";", 1) + [None])[:2] | ||
| 214 | |||
| 211 | urlp = urlparse.urlparse(uri) | 215 | urlp = urlparse.urlparse(uri) |
| 212 | self.scheme = urlp.scheme | 216 | self.scheme = urlp.scheme |
| 213 | 217 | ||
| @@ -242,17 +246,7 @@ class URI(object): | |||
| 242 | if urlp.password: | 246 | if urlp.password: |
| 243 | self.userinfo += ':%s' % urlp.password | 247 | self.userinfo += ':%s' % urlp.password |
| 244 | 248 | ||
| 245 | # Do support params even for URI schemes that Python's | 249 | self.path = urllib.unquote(urlp.path) |
| 246 | # urlparse doesn't support params for. | ||
| 247 | path = '' | ||
| 248 | param_str = '' | ||
| 249 | if not urlp.params: | ||
| 250 | path, param_str = (list(urlp.path.split(";", 1)) + [None])[:2] | ||
| 251 | else: | ||
| 252 | path = urlp.path | ||
| 253 | param_str = urlp.params | ||
| 254 | |||
| 255 | self.path = urllib.unquote(path) | ||
| 256 | 250 | ||
| 257 | if param_str: | 251 | if param_str: |
| 258 | self.params = self._param_str_split(param_str, ";") | 252 | self.params = self._param_str_split(param_str, ";") |
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 15fe0ab2f2..4fb2178595 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
| @@ -74,6 +74,24 @@ class URITest(unittest.TestCase): | |||
| 74 | }, | 74 | }, |
| 75 | 'relative': False | 75 | 'relative': False |
| 76 | }, | 76 | }, |
| 77 | "http://www.example.org/index.html?qparam1=qvalue1;param2=value2" : { | ||
| 78 | 'uri': 'http://www.example.org/index.html?qparam1=qvalue1;param2=value2', | ||
| 79 | 'scheme': 'http', | ||
| 80 | 'hostname': 'www.example.org', | ||
| 81 | 'port': None, | ||
| 82 | 'hostport': 'www.example.org', | ||
| 83 | 'path': '/index.html', | ||
| 84 | 'userinfo': '', | ||
| 85 | 'username': '', | ||
| 86 | 'password': '', | ||
| 87 | 'params': { | ||
| 88 | 'param2': 'value2' | ||
| 89 | }, | ||
| 90 | 'query': { | ||
| 91 | 'qparam1': 'qvalue1' | ||
| 92 | }, | ||
| 93 | 'relative': False | ||
| 94 | }, | ||
| 77 | "http://www.example.com:8080/index.html" : { | 95 | "http://www.example.com:8080/index.html" : { |
| 78 | 'uri': 'http://www.example.com:8080/index.html', | 96 | 'uri': 'http://www.example.com:8080/index.html', |
| 79 | 'scheme': 'http', | 97 | 'scheme': 'http', |
