JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-5628

Mule breaks multipart/form-data encoded messages

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 3.1.1
  • Fix Version/s: 3.1.4 (EE only), 3.2.1
  • Component/s: Modules: Jersey
  • Labels:
    • jersey
    • mule
  • Environment:

    Fedora 15
    java-1.6.0-openjdk-1.6.0.0-58.1.10.2.fc15.i686

  • User impact:
    High
  • Configuration:
    Hide
    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
    http://www.mulesoft.org/schema/mule/jersey
    http://www.mulesoft.org/schema/mule/jersey/3.0/mule-jersey.xsd
    http://jersey.apache.org/core http://jersey.apache.org/schemas/core.xsd">
    
    	<flow name="X12ToSummaryHtml">
    		<inbound-endpoint address="http://localhost:8080/jersey" />
    		<jersey:resources>
    			<component class="com.optuminsight.unionstation.service.X12ToSummaryHtml" />
    		</jersey:resources>
    	</flow>
    </mule>
    @POST
        @Path("/getSummaryHtml")
        @Consumes(MediaType.MULTIPART_FORM_DATA)
        @Produces("text/html")
        public final Response getSummaryHtml(@FormDataParam("x12file") final InputStream x12file) throws IOException {
            LOG.info("called getSummaryHtml");
            return Response.ok(IOUtils.toString(x12file)).build();
        }
    Show
    <?xml version="1.0" encoding="UTF-8"?>
    <mule xmlns="http://www.mulesoft.org/schema/mule/core"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:spring="http://www.springframework.org/schema/beans"
    xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
    xsi:schemaLocation="
    http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
    http://www.mulesoft.org/schema/mule/jersey
    http://www.mulesoft.org/schema/mule/jersey/3.0/mule-jersey.xsd
    http://jersey.apache.org/core http://jersey.apache.org/schemas/core.xsd">
    
    	<flow name="X12ToSummaryHtml">
    		<inbound-endpoint address="http://localhost:8080/jersey" />
    		<jersey:resources>
    			<component class="com.optuminsight.unionstation.service.X12ToSummaryHtml" />
    		</jersey:resources>
    	</flow>
    </mule>
    @POST
        @Path("/getSummaryHtml")
        @Consumes(MediaType.MULTIPART_FORM_DATA)
        @Produces("text/html")
        public final Response getSummaryHtml(@FormDataParam("x12file") final InputStream x12file) throws IOException {
            LOG.info("called getSummaryHtml");
            return Response.ok(IOUtils.toString(x12file)).build();
        }
  • Log Output:
    Hide
    About to connect() to localhost port 8080 (#0)
    Trying 127.0.0.1... connected
    Connected to localhost (127.0.0.1) port 8080 (#0)

    POST /jersey/X12ToSummaryHtml/getHtml/ HTTP/1.1
    User-Agent: curl/7.21.3 (i386-redhat-linux-gnu) libcurl/7.21.3 NSS/3.12.10.0 zlib/1.2.5 libidn/1.19 libssh2/1.2.7
    Host: localhost:8080
    Accept: /
    Content-Length: 2706
    Expect: 100-continue
    Content-Type: multipart/form-data; boundary=----------------------------55b24ac88245
    < HTTP/1.1 100 Continue
    < Content-Type: text/plain
    < Content-Length: 0
    < Connection: close
    < HTTP/1.1 400 Bad Request
    < Content-Type: multipart/form-data; boundary=----------------------------55b24ac88245
    < Date: Sat, 25 Jun 2011 01:29:10 MDT
    < Server: Mule Core/3.1.1
    < Expires: Sat, 25 Jun 2011 01:29:10 MDT
    < http.status: 400
    < MULE_ENCODING: UTF-8
    < Transfer-Encoding: chunked
    < Connection: close
    <
    Show
    About to connect() to localhost port 8080 (#0) Trying 127.0.0.1... connected Connected to localhost (127.0.0.1) port 8080 (#0) POST /jersey/X12ToSummaryHtml/getHtml/ HTTP/1.1 User-Agent: curl/7.21.3 (i386-redhat-linux-gnu) libcurl/7.21.3 NSS/3.12.10.0 zlib/1.2.5 libidn/1.19 libssh2/1.2.7 Host: localhost:8080 Accept: / Content-Length: 2706 Expect: 100-continue Content-Type: multipart/form-data; boundary=----------------------------55b24ac88245 < HTTP/1.1 100 Continue < Content-Type: text/plain < Content-Length: 0 < Connection: close < HTTP/1.1 400 Bad Request < Content-Type: multipart/form-data; boundary=----------------------------55b24ac88245 < Date: Sat, 25 Jun 2011 01:29:10 MDT < Server: Mule Core/3.1.1 < Expires: Sat, 25 Jun 2011 01:29:10 MDT < http.status: 400 < MULE_ENCODING: UTF-8 < Transfer-Encoding: chunked < Connection: close <
  • Similar Issues:
    None

Description

I wrote a Jersey class that was supposed to accept a multipart/form-data encoded POST from a html form. It returned a 400 error. Digging into the actual problem, I found that a MIMEParsingException is being thrown by mimepull (a Jersey dependency). The body of the post is getting corrupted somehow. I've confirmed that the Jersey class is working correctly by deploying it in a Jetty container and testing it there.

Until this gets fixed, I can't create a web service that accepts files

The original report is at http://forums.mulesoft.org/thread.jspa?messageID=16784#16784

Issue Links

is duplicated by

Bug - A problem which impairs or prevents the functions of the product. MULE-5828 POSTing a multipart/form-data message w/o a payload parameter throws IllegalArgumentException

  • Critical - Crashes, loss of data, severe memory leak.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Andrew Perepelytsya made changes - 01/Jul/11 02:42 PM
Field Original Value New Value
Configuration <?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
http://www.mulesoft.org/schema/mule/jersey
http://www.mulesoft.org/schema/mule/jersey/3.0/mule-jersey.xsd
http://jersey.apache.org/core http://jersey.apache.org/schemas/core.xsd">

<flow name="X12ToSummaryHtml">
<inbound-endpoint address="http://localhost:8080/jersey" />
<jersey:resources>
<component class="com.optuminsight.unionstation.service.X12ToSummaryHtml" />
</jersey:resources>
</flow>
</mule>

    @POST
    @Path("/getSummaryHtml")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces("text/html")
    public final Response getSummaryHtml(@FormDataParam("x12file") final InputStream x12file) throws IOException {
        LOG.info("called getSummaryHtml");
        return Response.ok(IOUtils.toString(x12file)).build();
    }
{code:xml}<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:jersey="http://www.mulesoft.org/schema/mule/jersey"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.1/mule.xsd
http://www.mulesoft.org/schema/mule/jersey
http://www.mulesoft.org/schema/mule/jersey/3.0/mule-jersey.xsd
http://jersey.apache.org/core http://jersey.apache.org/schemas/core.xsd">

<flow name="X12ToSummaryHtml">
<inbound-endpoint address="http://localhost:8080/jersey" />
<jersey:resources>
<component class="com.optuminsight.unionstation.service.X12ToSummaryHtml" />
</jersey:resources>
</flow>
</mule>
{code}

{code:java}
    @POST
    @Path("/getSummaryHtml")
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces("text/html")
    public final Response getSummaryHtml(@FormDataParam("x12file") final InputStream x12file) throws IOException {
        LOG.info("called getSummaryHtml");
        return Response.ok(IOUtils.toString(x12file)).build();
    }
{code}
Mike Schilling made changes - 19/Aug/11 10:14 AM
Priority Blocker [ 1 ] Critical [ 2 ]
Hide
Permalink
Mark Bonano added a comment - 26/Sep/11 11:07 AM

I have encounter the same issue running Mule 3.2.0. Is someone looking into this? Multipart/form-data encoding is a requirement for my project and this fix is mission-critical.

Show
Mark Bonano added a comment - 26/Sep/11 11:07 AM I have encounter the same issue running Mule 3.2.0. Is someone looking into this? Multipart/form-data encoding is a requirement for my project and this fix is mission-critical.
Santiago Vacas
26/Sep/11 03:40 PM
View full commit
MULE-5628: Mule breaks multipart/form-data encoded messages Default behavior preserves the multipart message as the payload. To store "payload" part as payload and the rest as attachments a messageFactory service override is required using HttpMultipartMuleMessageFactory (default previous behavior) git-svn-id: https://svn.codehaus.org/mule/branches/mule-3.1.x@23032 bf997673-6b11-0410-b953-e057580c5b09
3.1.x
+13
-84
transports/http/src/main/java/org/mule/transport/http/HttpMuleMessageFactory.java
Added
transports/http/src/main/java/org/mule/transport/http/HttpMultipartMuleMessageFactory.java
+26
-
transports/http/src/test/java/org/mule/transport/http/HttpMuleMessageFactoryTestCase.java
Added
transports/http/src/test/java/org/mule/transport/http/HttpMultipartMuleMessageFactoryTestCase.java
+5
-1
transports/http/src/test/resources/http-attachments-functional-test.xml
Santiago Vacas made changes - 29/Sep/11 03:41 PM
Assignee Santiago Vacas [ svacas ]
Santiago Vacas made changes - 29/Sep/11 03:42 PM
Status Open [ 1 ] In Progress [ 3 ]
Santiago Vacas made changes - 29/Sep/11 03:43 PM
Fix Version/s 3.1.4 [ 11079 ]
Fix Version/s 3.2.1 [ 11078 ]
Hide
Permalink
Santiago Vacas added a comment - 29/Sep/11 03:45 PM

3.1.x: https://fisheye.codehaus.org/changelog/mule/?cs=23032

Show
Santiago Vacas added a comment - 29/Sep/11 03:45 PM 3.1.x: https://fisheye.codehaus.org/changelog/mule/?cs=23032
Santiago Vacas made changes - 29/Sep/11 03:45 PM
Status In Progress [ 3 ] To Be Merged [ 10001 ]
Hide
Permalink
Ben Mathews added a comment - 11/Oct/11 03:36 PM

This fisheye link doesn't work. Is there a good one to look at the patch? Is it going to get merged?

I looked at Santiago's commit stream at https://fisheye.codehaus.org/user/svacas and didn't see anything that seemed to match this bug.

Show
Ben Mathews added a comment - 11/Oct/11 03:36 PM This fisheye link doesn't work. Is there a good one to look at the patch? Is it going to get merged? I looked at Santiago's commit stream at https://fisheye.codehaus.org/user/svacas and didn't see anything that seemed to match this bug.
Hide
Permalink
Ben Mathews added a comment - 12/Oct/11 01:36 PM

There isn't any commit that I can find, so nothing to merge.

Show
Ben Mathews added a comment - 12/Oct/11 01:36 PM There isn't any commit that I can find, so nothing to merge.
Ben Mathews made changes - 12/Oct/11 01:36 PM
Status To Be Merged [ 10001 ] Reopened [ 4 ]
Santiago Vacas
12/Oct/11 02:44 PM
View full commit
Merged revisions 23032 via svnmerge from https://svn.codehaus.org/mule/branches/mule-3.1.x ........ r23032 | svacas | 2011-09-26 17:40:42 -0300 (Mon, 26 Sep 2011) | 6 lines MULE-5628: Mule breaks multipart/form-data encoded messages Default behavior preserves the multipart message as the payload. To store "payload" part as payload and the rest as attachments a messageFactory service override is required using HttpMultipartMuleMessageFactory (default previous behavior) ........ git-svn-id: https://svn.codehaus.org/mule/branches/mule-3.2.x@23160 bf997673-6b11-0410-b953-e057580c5b09
mule-3.2.x
+13
-84
transports/http/src/main/java/org/mule/transport/http/HttpMuleMessageFactory.java
Added
transports/http/src/main/java/org/mule/transport/http/HttpMultipartMuleMessageFactory.java
+26
-
transports/http/src/test/java/org/mule/transport/http/HttpMuleMessageFactoryTestCase.java
Added
transports/http/src/test/java/org/mule/transport/http/HttpMultipartMuleMessageFactoryTestCase.java
+4
-
transports/http/src/test/resources/http-attachments-functional-test-flow.xml
... 1 more files not shown
Santiago Vacas
12/Oct/11 03:51 PM
View full commit
Merged revisions 23160 via svnmerge from https://svn.codehaus.org/mule/branches/mule-3.2.x ................ r23160 | svacas | 2011-10-12 16:44:07 -0300 (Wed, 12 Oct 2011) | 13 lines Merged revisions 23032 via svnmerge from https://svn.codehaus.org/mule/branches/mule-3.1.x ........ r23032 | svacas | 2011-09-26 17:40:42 -0300 (Mon, 26 Sep 2011) | 6 lines MULE-5628: Mule breaks multipart/form-data encoded messages Default behavior preserves the multipart message as the payload. To store "payload" part as payload and the rest as attachments a messageFactory service override is required using HttpMultipartMuleMessageFactory (default previous behavior) ........ ................ git-svn-id: https://svn.codehaus.org/mule/branches/mule-3.x@23162 bf997673-6b11-0410-b953-e057580c5b09
mule-3.3.3
+13
-84
transports/http/src/main/java/org/mule/transport/http/HttpMuleMessageFactory.java
Added
transports/http/src/main/java/org/mule/transport/http/HttpMultipartMuleMessageFactory.java
+26
-
transports/http/src/test/java/org/mule/transport/http/HttpMuleMessageFactoryTestCase.java
Added
transports/http/src/test/java/org/mule/transport/http/HttpMultipartMuleMessageFactoryTestCase.java
+4
-
transports/http/src/test/resources/http-attachments-functional-test-flow.xml
... 1 more files not shown
Hide
Permalink
Santiago Vacas added a comment - 13/Oct/11 08:55 AM

fisheye seems to be taking ages to scan the repository.
You can use svn diff to see the changes:

svn diff -c23032 https://svn.codehaus.org/mule/branches/mule-3.1.x

Show
Santiago Vacas added a comment - 13/Oct/11 08:55 AM fisheye seems to be taking ages to scan the repository. You can use svn diff to see the changes: svn diff -c23032 https://svn.codehaus.org/mule/branches/mule-3.1.x
Hide
Permalink
Ben Mathews added a comment - 17/Oct/11 02:49 PM

I built a patched version of 3.2.0 with the above commit and it works great. Thanks.

Show
Ben Mathews added a comment - 17/Oct/11 02:49 PM I built a patched version of 3.2.0 with the above commit and it works great. Thanks.
Dirk Olmes made changes - 18/Oct/11 03:32 AM
Status Reopened [ 4 ] Closed [ 6 ]
Resolution Fixed [ 1 ]
Hide
Permalink
Santiago Vacas added a comment - 18/Oct/11 07:53 AM

3.1.x: https://fisheye.codehaus.org/changelog/mule/?cs=23032
3.2.x: https://fisheye.codehaus.org/changelog/mule/?cs=23160
3.x: http://fisheye.codehaus.org/changelog/mule/?cs=23162

Show
Santiago Vacas added a comment - 18/Oct/11 07:53 AM 3.1.x: https://fisheye.codehaus.org/changelog/mule/?cs=23032 3.2.x: https://fisheye.codehaus.org/changelog/mule/?cs=23160 3.x: http://fisheye.codehaus.org/changelog/mule/?cs=23162
Pablo Kraan made changes - 30/Nov/11 02:26 PM
Link This issue is duplicated by MULE-5828 [ MULE-5828 ]
Santiago Vacas made changes - 12/Dec/11 08:24 AM
Link This issue is duplicated by EE-2493 [ EE-2493 ]
Transition Time In Source Status Execution Times Last Executer Last Execution Date
Open Open In Progress In Progress
90d 3h 49m 1 Santiago Vacas 29/Sep/11 03:42 PM
In Progress In Progress To Be Merged To Be Merged
3m 28s 1 Santiago Vacas 29/Sep/11 03:45 PM
To Be Merged To Be Merged Reopened Reopened
12d 21h 50m 1 Ben Mathews 12/Oct/11 01:36 PM
Reopened Reopened Closed Closed
5d 13h 56m 1 Dirk Olmes 18/Oct/11 03:32 AM
This list may be incomplete, as errors occurred whilst retrieving source from linked applications:
  • Repository mule on http://foo.bar/ failed: Error in remote call to 'FishEye 0 (http://foo.bar/)' (http://foo.bar) [AbstractRestCommand{path='/rest-service-fe/changeset-v1/listChangesets/', params={expand=changesets[-21:-1].revisions[0:29], comment=MULE-5628, p4JobFixed=MULE-5628, rep=mule}, methodType=GET}] : java.net.UnknownHostException: foo.bar

People

  • Assignee:
    Santiago Vacas
    Reporter:
    Ben Mathews
Vote (1)
Watch (0)

Dates

  • Created:
    01/Jul/11 11:53 AM
    Updated:
    12/Dec/11 08:24 AM
    Resolved:
    18/Oct/11 03:32 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.