diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2012-05-15 15:59:19 (GMT) |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2012-05-15 15:59:19 (GMT) |
commit | b0d85fd1b5714582f12ecb84baa9118f16884013 (patch) | |
tree | 8387493a18718aaee29a80a4eac46609f575a874 /Lib/urllib2.py | |
parent | 6a2a6c2ee37dad75134c212d43e48702f1b219a9 (diff) | |
download | cpython-b0d85fd1b5714582f12ecb84baa9118f16884013.zip cpython-b0d85fd1b5714582f12ecb84baa9118f16884013.tar.gz cpython-b0d85fd1b5714582f12ecb84baa9118f16884013.tar.bz2 |
Issue12541 - Add UserWarning for unquoted realms
Diffstat (limited to 'Lib/urllib2.py')
-rw-r--r-- | Lib/urllib2.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/urllib2.py b/Lib/urllib2.py index 21b5262..d4596cd 100644 --- a/Lib/urllib2.py +++ b/Lib/urllib2.py @@ -102,6 +102,7 @@ import sys import time import urlparse import bisect +import warnings try: from cStringIO import StringIO @@ -861,6 +862,9 @@ class AbstractBasicAuthHandler: mo = AbstractBasicAuthHandler.rx.search(authreq) if mo: scheme, quote, realm = mo.groups() + if quote not in ['"', "'"]: + warnings.warn("Basic Auth Realm was unquoted", + UserWarning, 2) if scheme.lower() == 'basic': response = self.retry_http_basic_auth(host, req, realm) if response and response.code != 401: |