diff --git a/CHANGES.rst b/CHANGES.rst index 641976d4b..35b3f895d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,9 +1,3 @@ -v(next) -------- - -* Removed the use of :mod:`cgi` deprecated in Python 3.11 - -- by :user:`webknjaz`. - v18.8.0 ------- diff --git a/cherrypy/lib/httputil.py b/cherrypy/lib/httputil.py index f852cbd68..ced310a0a 100644 --- a/cherrypy/lib/httputil.py +++ b/cherrypy/lib/httputil.py @@ -12,8 +12,8 @@ import re import builtins from binascii import b2a_base64 +from cgi import parse_header from email.header import decode_header -from email.message import EmailMessage as _EmailMessage from http.server import BaseHTTPRequestHandler from urllib.parse import unquote_plus @@ -155,12 +155,7 @@ def __unicode__(self): @staticmethod def parse(elementstr): """Transform 'token;key=val' to ('token', {'key': 'val'}).""" - msg = _EmailMessage() - msg['content-type'] = elementstr - - initial_value = msg.get_content_type() - params = dict(msg['content-type'].params) - + initial_value, params = parse_header(elementstr) return initial_value, params @classmethod