@@ -1241,7 +1241,7 @@ def data_callback(name: CallbackName, end_i: int, remaining: bool = False) -> No
12411241 elif state == MultipartState .HEADER_VALUE_ALMOST_DONE :
12421242 # The last character should be a LF. If not, it's an error.
12431243 if c != LF :
1244- msg = "Did not find LF character at end of header " " (found %r)" % (c ,)
1244+ msg = "Did not find LF character at end of header (found %r)" % (c ,)
12451245 self .logger .warning (msg )
12461246 e = MultipartParseError (msg )
12471247 e .offset = i
@@ -1783,7 +1783,6 @@ def create_form_parser(
17831783 headers : dict [str , bytes ],
17841784 on_field : OnFieldCallback | None ,
17851785 on_file : OnFileCallback | None ,
1786- trust_x_headers : bool = False ,
17871786 config : dict [Any , Any ] = {},
17881787) -> FormParser :
17891788 """This function is a helper function to aid in creating a FormParser
@@ -1796,8 +1795,6 @@ def create_form_parser(
17961795 headers: A dictionary-like object of HTTP headers. The only required header is Content-Type.
17971796 on_field: Callback to call with each parsed field.
17981797 on_file: Callback to call with each parsed file.
1799- trust_x_headers: Whether or not to trust information received from certain X-Headers - for example, the file
1800- name from X-File-Name.
18011798 config: Configuration variables to pass to the FormParser.
18021799 """
18031800 content_type : str | bytes | None = headers .get ("Content-Type" )
@@ -1813,14 +1810,8 @@ def create_form_parser(
18131810 # We need content_type to be a string, not a bytes object.
18141811 content_type = content_type .decode ("latin-1" )
18151812
1816- # File names are optional.
1817- if trust_x_headers :
1818- file_name = headers .get ("X-File-Name" )
1819- else :
1820- file_name = None
1821-
18221813 # Instantiate a form parser.
1823- form_parser = FormParser (content_type , on_field , on_file , boundary = boundary , file_name = file_name , config = config )
1814+ form_parser = FormParser (content_type , on_field , on_file , boundary = boundary , config = config )
18241815
18251816 # Return our parser.
18261817 return form_parser
0 commit comments