Refs -- Added helpful message for non-ASCII Content-Type in mulitpart request.
@@ -67,7 +67,10 @@ class MultiPartParser:
raise MultiPartParserError('Invalid Content-Type: %s' % content_type)
# Parse the header to get the boundary to split the parts.
+ try:
ctypes, opts = parse_header(content_type.encode('ascii'))
+ except UnicodeEncodeError:
+ raise MultiPartParserError('Invalid non-ASCII Content-Type in multipart: %s' % force_str(content_type))
boundary = opts.get('boundary')
if not boundary or not cgi.valid_boundary(boundary):
raise MultiPartParserError('Invalid boundary in multipart: %s' % force_str(boundary))
