diff options
Diffstat (limited to 'main.py')
| -rwxr-xr-x | main.py | 9 |
1 files changed, 8 insertions, 1 deletions
| @@ -276,10 +276,17 @@ class _UserAgentHandler(urllib2.BaseHandler): | |||
| 276 | class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler): | 276 | class _BasicAuthHandler(urllib2.HTTPBasicAuthHandler): |
| 277 | def http_error_auth_reqed(self, authreq, host, req, headers): | 277 | def http_error_auth_reqed(self, authreq, host, req, headers): |
| 278 | try: | 278 | try: |
| 279 | old_add_header = req.add_header | ||
| 280 | def _add_header(name, val): | ||
| 281 | val = val.replace('\n', '') | ||
| 282 | old_add_header(name, val) | ||
| 283 | req.add_header = _add_header | ||
| 279 | return urllib2.AbstractBasicAuthHandler.http_error_auth_reqed( | 284 | return urllib2.AbstractBasicAuthHandler.http_error_auth_reqed( |
| 280 | self, authreq, host, req, headers) | 285 | self, authreq, host, req, headers) |
| 281 | except: | 286 | except: |
| 282 | self.reset_retry_count() | 287 | reset = getattr(self, 'reset_retry_count', None) |
| 288 | if reset is not None: | ||
| 289 | reset() | ||
| 283 | raise | 290 | raise |
| 284 | 291 | ||
| 285 | def init_http(): | 292 | def init_http(): |
