Dulwich.io dulwich / fb31b0a
Track url in HTTPUnauthorized. Jelmer Vernooń≥ a month ago
1 changed file(s) with 5 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
122122 class HTTPUnauthorized(Exception):
123123 """Raised when authentication fails."""
124124
125 def __init__(self, www_authenticate):
125 def __init__(self, www_authenticate, url):
126126 Exception.__init__(self, "No valid credentials provided")
127127 self.www_authenticate = www_authenticate
128 self.url = url
128129
129130
130131 def _fileno_can_read(fileno):
16361637
16371638 if resp.status == 404:
16381639 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:
16421643 raise GitProtocolError("unexpected http resp %d for %s" %
16431644 (resp.status, url))
16441645