Closed issue by Earnestly on mblaze repository https://github.com/leahneukirchen/mblaze/issues/212 Description: Version: https://github.com/leahneukirchen/mblaze/commit/4ccf2f08c1aa8b15f31ac469edebe6c4710d74f1 For full disclosure I'm attempting to reuse `mshow` for POST data instead of email so perhaps this expected but I was hoping you may have some insight into this behaviour I'm witnessing. Here is an example file I am working with, it included CRLFs (I'm not sure if github strips them): ``` Content-Type: multipart/form-data; boundary=------------------------55a586f81559face --------------------------55a586f81559face Content-Disposition: form-data; name="a"; filename="foo" Content-Type: application/octet-stream foo --------------------------55a586f81559face Content-Disposition: form-data; name="a"; filename="bar" Content-Type: application/octet-stream bar --------------------------55a586f81559face-- ``` When in this form it appears to work as I would expect: ``` % mshow -t - < example /dev/stdin 1: multipart/form-data size=346 2: application/octet-stream size=4 name="foo" 3: application/octet-stream size=4 name="bar" ``` However if any of the content contains a newline it appears to throw `mshow` off. ``` Content-Type: multipart/form-data; boundary=------------------------55a586f81559face --------------------------55a586f81559face Content-Disposition: form-data; name="a"; filename="foo" Content-Type: application/octet-stream foo baz ^ newline --------------------------55a586f81559face Content-Disposition: form-data; name="a"; filename="bar" Content-Type: application/octet-stream bar --------------------------55a586f81559face-- ``` ``` % mshow -t - < example /dev/stdin 1: multipart/form-data size=212 name="foo" 2: application/octet-stream size=4 name="bar" % mshow -x - < example foo bar % head -n-0 foo bar ==> foo <== baz ^ newline --------------------------55a586f81559face Content-Disposition: form-data; name="a"; filename="bar" Content-Type: application/octet-stream bar --------------------------55a586f81559face-- ==> bar <== bar ``` If I include a newline in `bar` then `mshow` would produce an empty file. Am I doing anything wrong or is `mshow` not an appropriate for POST multipart/form-data? Edit: Quick attempt with python's `email` module gets me this: ``` >>> import email >>> f = open('example') >>> m = email.message_from_file(f) >>> for p in m.get_payload(): print(p) ... Content-Disposition: form-data; name="a"; filename="foo" Content-Type: application/octet-stream foo baz ^ newline Content-Disposition: form-data; name="a"; filename="bar" Content-Type: application/octet-stream bar >>> for p in m.get_payload(): print(p.get_payload(decode=True)) ... b'foo\n\nbaz ^ newline\n' b'bar\n\n' ```