From: Earnestly <Earnestly@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [ISSUE] Confusing mshow behaviour with multipart/form-data
Date: Sun, 29 Aug 2021 18:09:11 +0200 [thread overview]
Message-ID: <gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-212@inbox.vuxu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 2364 bytes --]
New 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?
next reply other threads:[~2021-08-29 16:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-29 16:09 Earnestly [this message]
2021-08-29 18:07 ` leahneukirchen
2021-08-29 18:08 ` leahneukirchen
2021-08-29 19:18 ` Earnestly
2021-08-29 19:22 ` Earnestly
2021-08-29 19:36 ` Earnestly
2021-08-29 19:36 ` Earnestly
2021-08-29 19:37 ` Earnestly
2021-08-30 11:44 ` leahneukirchen
2021-08-30 11:46 ` leahneukirchen
2021-08-30 11:59 ` leahneukirchen
2021-08-30 16:13 ` leahneukirchen
2021-08-30 18:12 ` Earnestly
2021-08-30 18:19 ` leahneukirchen
2021-08-30 18:24 ` [ISSUE] [CLOSED] " Earnestly
2021-08-30 18:24 ` Earnestly
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=gh-mailinglist-notifications-fa6558a0-26e0-48f6-803f-f5a8af34f6a8-mblaze-212@inbox.vuxu.org \
--to=earnestly@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).