@@ -126,7 +126,6 @@ class MultipartState(IntEnum):
126126SPACE = b" " [0 ]
127127HYPHEN = b"-" [0 ]
128128AMPERSAND = b"&" [0 ]
129- SEMICOLON = b";" [0 ]
130129LOWER_A = b"a" [0 ]
131130LOWER_Z = b"z" [0 ]
132131NULL = b"\x00 " [0 ]
@@ -840,13 +839,13 @@ def _internal_write(self, data: bytes, length: int) -> int:
840839 # yet reached a separator, and thus, if we do, we need to skip
841840 # it as it will be the boundary between fields that's supposed
842841 # to be there.
843- if ch == AMPERSAND or ch == SEMICOLON :
842+ if ch == AMPERSAND :
844843 if found_sep :
845844 # If we're parsing strictly, we disallow blank chunks.
846845 if strict_parsing :
847- raise QuerystringParseError ("Skipping duplicate ampersand/semicolon at %d" % i , offset = i )
846+ raise QuerystringParseError ("Skipping duplicate ampersand at %d" % i , offset = i )
848847 else :
849- self .logger .debug ("Skipping duplicate ampersand/semicolon at %d" , i )
848+ self .logger .debug ("Skipping duplicate ampersand at %d" , i )
850849 else :
851850 # This case is when we're skipping the (first)
852851 # separator between fields, so we just set our flag
@@ -864,17 +863,15 @@ def _internal_write(self, data: bytes, length: int) -> int:
864863 elif state == QuerystringState .FIELD_NAME :
865864 # Try and find a separator - we ensure that, if we do, we only
866865 # look for the equal sign before it.
867- sep_pos = data .find (b"&" , i )
868- if sep_pos == - 1 :
869- sep_pos = data .find (b";" , i )
866+ sep_pos = data .find (b"&" , i , length )
870867
871868 # See if we can find an equals sign in the remaining data. If
872869 # so, we can immediately emit the field name and jump to the
873870 # data state.
874871 if sep_pos != - 1 :
875872 equals_pos = data .find (b"=" , i , sep_pos )
876873 else :
877- equals_pos = data .find (b"=" , i )
874+ equals_pos = data .find (b"=" , i , length )
878875
879876 if equals_pos != - 1 :
880877 # Emit this name.
@@ -921,11 +918,8 @@ def _internal_write(self, data: bytes, length: int) -> int:
921918 i = length
922919
923920 elif state == QuerystringState .FIELD_DATA :
924- # Try finding either an ampersand or a semicolon after this
925- # position.
926- sep_pos = data .find (b"&" , i )
927- if sep_pos == - 1 :
928- sep_pos = data .find (b";" , i )
921+ # Try finding an ampersand after this position.
922+ sep_pos = data .find (b"&" , i , length )
929923
930924 # If we found it, callback this bit as data and then go back
931925 # to expecting to find a field.
0 commit comments