Track url in HTTPUnauthorized.
Jelmer Vernooij
a month ago
122 | 122 | class HTTPUnauthorized(Exception): |
123 | 123 | """Raised when authentication fails.""" |
124 | 124 | |
125 | def __init__(self, www_authenticate): | |
125 | def __init__(self, www_authenticate, url): | |
126 | 126 | Exception.__init__(self, "No valid credentials provided") |
127 | 127 | self.www_authenticate = www_authenticate |
128 | self.url = url | |
128 | 129 | |
129 | 130 | |
130 | 131 | def _fileno_can_read(fileno): |
1636 | 1637 | |
1637 | 1638 | if resp.status == 404: |
1638 | 1639 | raise NotGitRepository() |
1639 | elif resp.status == 401: | |
1640 | raise HTTPUnauthorized(resp.getheader('WWW-Authenticate')) | |
1641 | elif resp.status != 200: | |
1640 | if resp.status == 401: | |
1641 | raise HTTPUnauthorized(resp.getheader('WWW-Authenticate'), url) | |
1642 | if resp.status != 200: | |
1642 | 1643 | raise GitProtocolError("unexpected http resp %d for %s" % |
1643 | 1644 | (resp.status, url)) |
1644 | 1645 |