should call lower just once
This commit is contained in:
parent
3d75e6ed95
commit
235687d983
|
@ -238,15 +238,15 @@ def parse_multipart_form(body, boundary):
|
||||||
break
|
break
|
||||||
|
|
||||||
colon_index = form_line.index(':')
|
colon_index = form_line.index(':')
|
||||||
form_header_field = form_line[0:colon_index]
|
form_header_field = form_line[0:colon_index].lower()
|
||||||
form_header_value, form_parameters = parse_header(
|
form_header_value, form_parameters = parse_header(
|
||||||
form_line[colon_index + 2:])
|
form_line[colon_index + 2:])
|
||||||
|
|
||||||
if form_header_field.lower() == 'content-disposition':
|
if form_header_field == 'content-disposition':
|
||||||
if 'filename' in form_parameters:
|
if 'filename' in form_parameters:
|
||||||
file_name = form_parameters['filename']
|
file_name = form_parameters['filename']
|
||||||
field_name = form_parameters.get('name')
|
field_name = form_parameters.get('name')
|
||||||
elif form_header_field.lower() == 'content-type':
|
elif form_header_field == 'content-type':
|
||||||
file_type = form_header_value
|
file_type = form_header_value
|
||||||
|
|
||||||
post_data = form_part[line_index:-4]
|
post_data = form_part[line_index:-4]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user