Content-Type header in multipart does not contain required parameter boundary
See original GitHub issueRFC: https://tools.ietf.org/html/rfc7578#appendix-A
Related Comment and issue: https://github.com/django/channels/issues/1386#issuecomment-568215439 https://twistedmatrix.com/trac/ticket/9739
Background:
Consider a multipart request as such:
Body:
--d66f495a-c4d1-487c-9277-9ab1a20001cc
Content-Disposition: form-data; name="content"
Content-Type: multipart/form-data; charset=utf-8
Anything
--d66f495a-c4d1-487c-9277-9ab1a20001cc--
Header:
Content-Type: multipart/form-data; boundary=d66f495a-c4d1-487c-9277-9ab1a20001cc
A new change in Python 3.7 considers this request multipart header as invalid, which according to @twm is not compliant with the latest change in the RFC (2015).
Hence, on new Python versions, when the request is parsed, it tries to get the boundary from the multipart body Content-Type
header and it returns empty string since there is none, and throws saying that is is Invalid Boundary
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (1 by maintainers)
Top Results From Across the Web
fetch - Missing boundary in multipart/form-data POST
The solution to the problem is to explicitly set Content-Type to undefined so that your browser or whatever client you're using can set...
Read more >RFC1341(MIME) : 7 The Multipart content type
The only mandatory parameter for the multipart Content-Type is the boundary parameter, which consists of 1 to 70 characters from a set of...
Read more >Multipart Bodies - Documentation - Perforce Software
All multipart types require that the header value contain a boundary parameter. The value of the boundary parameter delimits the parts of the...
Read more >Multipart | Distech Controls Wiki
The Content-Type field for multipart entities requires one parameter, "boundary", which is used to specify the encapsulation boundary.
Read more >RFC 7578: Returning Values from Forms: multipart/form-data
It has received public review and has been approved for publication by the ... the "boundary" parameter values in quotes in the Content-Type...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t see anything in https://github.com/square/okhttp/blob/master/okhttp/src/main/java/okhttp3/MultipartBody.kt that would generate this header. Nor do I see such sniffing here https://github.com/square/okhttp/blob/master/okhttp/src/main/java/okhttp3/RequestBody.kt Does your application code set it?
Thanks. Will try and revert