Removed unnecessary _parse_header() from MultiPartParser.

Reraising ValueError was unused since its introduction in
d725cc9734.
This commit is contained in:
Mariusz Felisiak 2022-06-28 09:27:03 +02:00 committed by GitHub
parent 9cf2564d38
commit bff5c114be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 10 deletions

View File

@ -655,14 +655,6 @@ def parse_boundary_stream(stream, max_header_size):
# the payload. # the payload.
header_end = chunk.find(b"\r\n\r\n") header_end = chunk.find(b"\r\n\r\n")
def _parse_header(line):
main_value_pair, params = parse_header(line)
try:
name, value = main_value_pair.split(":", 1)
except ValueError:
raise ValueError("Invalid header: %r" % line)
return name, (value, params)
if header_end == -1: if header_end == -1:
# we find no header, so we just mark this fact and pass on # we find no header, so we just mark this fact and pass on
# the stream verbatim # the stream verbatim
@ -683,8 +675,9 @@ def parse_boundary_stream(stream, max_header_size):
# This terminology ("main value" and "dictionary of # This terminology ("main value" and "dictionary of
# parameters") is from the Python docs. # parameters") is from the Python docs.
try: try:
name, (value, params) = _parse_header(line) main_value_pair, params = parse_header(line)
except ValueError: name, value = main_value_pair.split(":", 1)
except ValueError: # Invalid header.
continue continue
if name == "content-disposition": if name == "content-disposition":