--- pisa_util.py.orig 2009-11-20 02:00:27.000000000 +0300 +++ pisa_util.py 2009-11-25 14:09:14.000000000 +0300 @@ -462,24 +462,35 @@ urlParts = urlparse.urlparse(uri) log.debug("URLParts: %r", urlParts) - + # Drive letters have len==1 but we are looking for things like http: if len(urlParts[0]) > 1 : # External data if basepath: uri = urlparse.urljoin(basepath, uri) - + #path = urlparse.urlsplit(url)[2] #mimetype = getMimeType(path) # Using HTTPLIB - server, path = urllib.splithost(uri[uri.find("//"):]) + netloc, path = urllib.splithost(uri[uri.find("//"):]) + if netloc.find("@"): + httpAuth = True + userid = netloc[:netloc.find(":")] + passwd = netloc[netloc.find(":")+1:netloc.find("@")] + server = netloc[netloc.find("@")+1:] + else: + server = netloc if uri.startswith("https://"): conn = httplib.HTTPSConnection(server) else: conn = httplib.HTTPConnection(server) - conn.request("GET", path) + conn.putrequest("GET", path) + if httpAuth: + auth = 'Basic ' + string.strip(base64.encodestring(userid + ':' + passwd)) + conn.putheader('Authorization', auth) + conn.endheaders() r1 = conn.getresponse() # log.debug("HTTP %r %r %r %r", server, path, uri, r1) if (r1.status, r1.reason) == (200, "OK"):