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

svn path=/main/branches/2.1.6/; revision=12225

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)