-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle messages containing only end boundary, fixes #38 #142
Conversation
Sounds feasible, let's get some clarity on it...
Edit: Apologies for the noise, I've not confirmed this but can see the following linked...
(And... probably not relevant if it's spec compliant or not if that's the actual behavior.) |
To me the spec isn't 100% clear. rfc2046 appears to assume that there is always at least one body part, so this would not be valid. But it doesn't make it clear how a form with no parts should be communicated either. Anyway, it's what Chrome (and probably Firefox, but I haven't tested myself) does now. Take the following text, adapted from the examples in #38
I got the following payload: (Chrome Version 124.0.6367.61 (Official Build) (64-bit))
Clicking (enabling) the check box in the form gives valid content with 1 part. |
any updates on this? |
2ace5c0
to
fcd5d4d
Compare
Rebased on current master. |
@jhnstrk I think my previous PR to fix the security advisory put this PR in a non-perfect state: If I run what you suggest: import python_multipart
boundary = b"-"
parser = python_multipart.MultipartParser(boundary)
parser.write(b"------WebKitFormBoundaryBBDliyOmePSMlFiJ--\r\n") I get Do you have suggestions on how we should fix it? |
This is expected though... setting the boundary to To test the empty message case you should use boundary = b"----WebKitFormBoundaryBBDliyOmePSMlFiJ" |
Some browsers create empty messages when forms are posted - see #38 for examples.
The fix here adds a new state in the parser which is entered when the first hyphen after the first boundary is encountered. This is only the case for the very first boundary. Anything but a second hyphen after the first is considered an error.