904 self.retried_req = req |
904 self.retried_req = req |
905 self.retried = 0 |
905 self.retried = 0 |
906 return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed( |
906 return urllib2.HTTPBasicAuthHandler.http_error_auth_reqed( |
907 self, auth_header, host, req, headers) |
907 self, auth_header, host, req, headers) |
908 |
908 |
909 def getauthinfo(path): |
|
910 scheme, netloc, urlpath, query, frag = urlparse.urlsplit(path) |
|
911 if not urlpath: |
|
912 urlpath = '/' |
|
913 if scheme != 'file': |
|
914 # XXX: why are we quoting the path again with some smart |
|
915 # heuristic here? Anyway, it cannot be done with file:// |
|
916 # urls since path encoding is os/fs dependent (see |
|
917 # urllib.pathname2url() for details). |
|
918 urlpath = quotepath(urlpath) |
|
919 host, port, user, passwd = netlocsplit(netloc) |
|
920 |
|
921 # urllib cannot handle URLs with embedded user or passwd |
|
922 url = urlparse.urlunsplit((scheme, netlocunsplit(host, port), |
|
923 urlpath, query, frag)) |
|
924 if user: |
|
925 netloc = host |
|
926 if port: |
|
927 netloc += ':' + port |
|
928 # Python < 2.4.3 uses only the netloc to search for a password |
|
929 authinfo = (None, (url, netloc), user, passwd or '') |
|
930 else: |
|
931 authinfo = None |
|
932 return url, authinfo |
|
933 |
|
934 handlerfuncs = [] |
909 handlerfuncs = [] |
935 |
910 |
936 def opener(ui, authinfo=None): |
911 def opener(ui, authinfo=None): |
937 ''' |
912 ''' |
938 construct an opener suitable for urllib2 |
913 construct an opener suitable for urllib2 |