summaryrefslogtreecommitdiffstats
path: root/Lib/Cookie.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2002-12-29 16:44:31 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2002-12-29 16:44:31 (GMT)
commit7877a76107d285f18eac05d8a26d8c25fc4727f6 (patch)
tree1a64feb51ea47f2cd289bc3884e5e1da61438ca0 /Lib/Cookie.py
parentea3fdf44a29accd666a3b5f058539c351d921657 (diff)
downloadcpython-7877a76107d285f18eac05d8a26d8c25fc4727f6.zip
cpython-7877a76107d285f18eac05d8a26d8c25fc4727f6.tar.gz
cpython-7877a76107d285f18eac05d8a26d8c25fc4727f6.tar.bz2
Patch #655760: add warnings when the unsafe *Cookie classes are instantiated
Diffstat (limited to 'Lib/Cookie.py')
-rw-r--r--Lib/Cookie.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/Lib/Cookie.py b/Lib/Cookie.py
index 6a45d9b..3b2592a 100644
--- a/Lib/Cookie.py
+++ b/Lib/Cookie.py
@@ -222,7 +222,7 @@ try:
except ImportError:
from pickle import dumps, loads
-import re
+import re, warnings
__all__ = ["CookieError","BaseCookie","SimpleCookie","SerialCookie",
"SmartCookie","Cookie"]
@@ -682,6 +682,11 @@ class SerialCookie(BaseCookie):
Note: HTTP has a 2k limit on the size of a cookie. This class
does not check for this limit, so be careful!!!
"""
+ def __init__(self, input=None):
+ warnings.warn("SerialCookie class is insecure; do not use it",
+ DeprecationWarning)
+ BaseCookie.__init__(self, input)
+ # end __init__
def value_decode(self, val):
# This could raise an exception!
return loads( _unquote(val) ), val
@@ -702,6 +707,11 @@ class SmartCookie(BaseCookie):
Note: HTTP has a 2k limit on the size of a cookie. This class
does not check for this limit, so be careful!!!
"""
+ def __init__(self, input=None):
+ warnings.warn("Cookie/SmartCookie class is insecure; do not use it",
+ DeprecationWarning)
+ BaseCookie.__init__(self, input)
+ # end __init__
def value_decode(self, val):
strval = _unquote(val)
try: