This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author quentel
Recipients Peter Landry, quentel, vstinner
Date 2015-08-07.10:47:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CA+gUBLS98EWV0evudQEdKcZ4jysV+Dk+sfSeLsCVL_cv=d3PYA@mail.gmail.com>
In-reply-to <CA+gUBLSqc+JkOgH+YtFMMF_ZsyQTd+E5mtHSLTu74v3DN2dpig@mail.gmail.com>
Content
I don't really see why there is a Content-Length in the headers of a
multipart form data. The specification at
http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 doesn't
mention it, and it is absent in the example that looks like the one tested
by Peter :

Content-Type: multipart/form-data; boundary=AaB03x
--AaB03x
Content-Disposition: form-data; name="submit-name"

Larry
--AaB03x
Content-Disposition: form-data; name="files"; filename="file1.txt"
Content-Type: text/plain
... contents of file1.txt ...
--AaB03x--

In case a user agent would insert it, I think the best would be to
ignore it. That is, inside read_multi(), after

            headers = parser.close()

add these lines :

            if 'content-length' in headers:
                del headers['content-length']

It's hard to see the potential side effects but I think it's cleaner
than the proposed patch, which is not correct anyway for another
reason : the attribute value is set to a bytes objects, instead of a
string.

Peter, does this make sense ? If so, can you submit another patch ?
History
Date User Action Args
2015-08-07 10:48:00quentelsetrecipients: + quentel, vstinner, Peter Landry
2015-08-07 10:48:00quentellinkissue24764 messages
2015-08-07 10:47:58quentelcreate