urlparse.urljoin() only works correctly with recognized protocols and
authorZac Medico <zmedico@gentoo.org>
Wed, 10 Dec 2008 03:37:03 +0000 (03:37 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 10 Dec 2008 03:37:03 +0000 (03:37 -0000)
requires the base url to have a trailing slash, so join PORTAGE_BINHOST
manually. Thanks to Lance Albertson <ramereth@g.o> for reporting.

svn path=/main/trunk/; revision=12192

pym/portage/dbapi/bintree.py

index 000624819807f51a809123a3598d01b9c0379d4c..2b0ebd6f4b26a0d789c49168db86212bf8603b5c 100644 (file)
@@ -643,7 +643,10 @@ class binarytree(object):
                        import urllib, urlparse
                        rmt_idx = self._new_pkgindex()
                        try:
-                               f = urllib.urlopen(urlparse.urljoin(base_url, "Packages"))
+                               # urlparse.urljoin() only works correctly with recognized
+                               # protocols and requires the base url to have a trailing
+                               # slash, so join manually...
+                               f = urllib.urlopen(base_url.rstrip("/") + "/Packages")
                                try:
                                        rmt_idx.readHeader(f)
                                        remote_timestamp = rmt_idx.header.get("TIMESTAMP", None)