Parsing multipart/form-data

20 views
Skip to first unread message

Stefan Adams

unread,
Nov 8, 2017, 1:59:45 PM11/8/17
to mojolicious
Below is the payload from $c->req->to_string.

Calling $c->req->upload('text') doesn't seem to get me anything.  How can I parse this payload?
$c->req->uploads is also empty.

POST /sg HTTP/1.1
X-Forwarded-Server: s1037989.com
Content-Length: 2045
Host: s1037989.com
User-Agent: Sendlib/1.0 mx0015p1las1.sendgrid.net
Connection: upgrade
X-Forwarded-Proto: https
X-Forwarded-Host: s1037989.com
Content-Type: multipart/form-data; boundary=xYzZY
X-Forwarded-For: 167.89.121.251

--xYzZY
Content-Disposition: form-data; name="headers"
Received: by mx0015p1las1.sendgrid.net with SMTP id aZ1Gv7yHUS Wed, 08 Nov 2017 17:49:34 +0000 (UTC)
Received: from s1037989.com (unknown [10.43.24.23]) by mx0015p1las1.sendgrid.net (Postfix) with ESMTP id 24382CE16E4 for <sd...@s1037989.com>; Wed,  8 Nov 2017 17:49:34 +0000 (UTC)
--xYzZY
Content-Disposition: form-data; name="dkim"
none
--xYzZY
Content-Disposition: form-data; name="to"
--xYzZY
Content-Disposition: form-data; name="from"
--xYzZY
Content-Disposition: form-data; name="text"
kjdkjfhkjf
--xYzZY
Content-Disposition: form-data; name="sender_ip"
10.43.24.23
--xYzZY
Content-Disposition: form-data; name="envelope"
{"to":["sd...@s1037989.com"],"from":"s103...@gmail.com"}
--xYzZY
Content-Disposition: form-data; name="attachments"
0
--xYzZY
Content-Disposition: form-data; name="subject"
--xYzZY
Content-Disposition: form-data; name="charsets"
{"to":"UTF-8","subject":"UTF-8","from":"UTF-8","text":"iso-8859-1"}
--xYzZY
Content-Disposition: form-data; name="SPF"
softfail
--xYzZY--

Stefan Adams

unread,
Nov 8, 2017, 2:38:13 PM11/8/17
to mojolicious
On Wed, Nov 8, 2017 at 12:59 PM, Stefan Adams <s103...@gmail.com> wrote:
Below is the payload from $c->req->to_string.

Calling $c->req->upload('text') doesn't seem to get me anything.  How can I parse this payload?
$c->req->uploads is also empty.

Resolved: use body_params.

I've never received this type of payload before so this is new to me.  Super cool!  Mojolicious FTW again!! 
Reply all
Reply to author
Forward
0 new messages