mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Merged revisions 81636 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r81636 | senthil.kumaran | 2010-06-01 18:10:07 +0530 (Tue, 01 Jun 2010) | 3 lines Fix Issue8797 - urllib2 basic authentication fix for wrong passwords. It fails after 5 retries. ........
This commit is contained in:
		
							parent
							
								
									d35251dc19
								
							
						
					
					
						commit
						f4998acb5a
					
				
					 2 changed files with 9 additions and 1 deletions
				
			
		|  | @ -775,12 +775,21 @@ def __init__(self, password_mgr=None): | |||
|             password_mgr = HTTPPasswordMgr() | ||||
|         self.passwd = password_mgr | ||||
|         self.add_password = self.passwd.add_password | ||||
|         self.retried = 0 | ||||
| 
 | ||||
|     def http_error_auth_reqed(self, authreq, host, req, headers): | ||||
|         # host may be an authority (without userinfo) or a URL with an | ||||
|         # authority | ||||
|         # XXX could be multiple headers | ||||
|         authreq = headers.get(authreq, None) | ||||
| 
 | ||||
|         if self.retried > 5: | ||||
|             # retry sending the username:password 5 times before failing. | ||||
|             raise HTTPError(req.get_full_url(), 401, "basic auth failed", | ||||
|                     headers, None) | ||||
|         else: | ||||
|             self.retried += 1 | ||||
| 
 | ||||
|         if authreq: | ||||
|             mo = AbstractBasicAuthHandler.rx.search(authreq) | ||||
|             if mo: | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Senthil Kumaran
						Senthil Kumaran