Kludex / python-multipart

A streaming multipart parser for Python.

Home Page:https://kludex.github.io/python-multipart/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parsing fails if part header name contains a number

jhnstrk opened this issue · comments

When custom headers are included in parts, and those header names contain numbers, the multipart parser throws an exception:

Found non-alphanumeric character 49 in header at 92

Numbers are perfectly valid in header names and shouldn't be rejected.

Sample data to reproduce the issue (X-funky-header-1 triggers it):

b'''--b8825ae386be4fdc9644d87e392caad3\r\n
Content-Type: text/plain; charset=utf-8\r\n
X-funky-header-1: bar\r\n
Content-Length: 6\r\n
Content-Disposition: attachment; filename="secret.txt"; name="files"\r\n\r\n
aaaaaa\r\n
--b8825ae386be4fdc9644d87e392caad3--\r\n'''