Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-644

Is MultiPartUploadHandler fully compliant with rfc2046?

XMLWordPrintable

      If we PUT a multi-part with a quoted boundary like

      Content-Type: multipart/form-data; boundary="asdasdasdasdasdasd2234vv45y3b4vhg3rtchg245"

      We receive an exception from MultiPartUploadHandler.parseBlocking at MultiPartParserDefinition.java:217

      java.io.IOException" , "exception message" : "UT000036: Connection terminated parsing multipart data" , "stack trace" : [ "java.io.IOException: UT000036: Connection terminated parsing multipart data" , " at io.undertow.server.handlers.form.MultiPartParserDefinition$MultiPartUploadHandler.parseBlocking(MultiPartParserDefinition.java:217)" , " at org.restheart.handlers.injectors.BodyInjectorHandler.handleRequest(BodyInjectorHandler.java:129)" , " at org.restheart.handlers.OptionsHandler.handleRequest(OptionsHandler.java:58)" , " at org.restheart.handlers.injectors.RequestContextInjectorHandler.handleRequest(RequestContextInjectorHandler.java:355)" , " at org.restheart.security.handlers.CORSHandler.handleRequest(CORSHandler.java:88)" , " at org.restheart.handlers.PipedHttpHandler.handleRequest(PipedHttpHandler.java:86)" , " at io.undertow.server.handlers.PathHandler.handleRequest(PathHandler.java:94)" , " at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)" , " at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)" , " at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)" , " at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)" , " at java.lang.Thread.run(Thread.java:745)"]}]}}

      But if we remove the quotes from the boundary

      Content-Type: multipart/form-data; boundary=35dafad7-391b-4450-bf0f-9cd4167463d6

      Then the PUT is successful.

      However, our understanding of the Multipart Media Type is that quotes in boundaries are permitted, as per https://www.ietf.org/rfc/rfc2046.txt

      WARNING TO IMPLEMENTORS: The grammar for parameters on the Content-
      type field is such that it is often necessary to enclose the boundary
      parameter values in quotes on the Content-type line. This is not
      always necessary, but never hurts. Implementors should be sure to
      study the grammar carefully in order to avoid producing invalid
      Content-type fields. Thus, a typical "multipart" Content-Type header
      field might look like this:

      Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08j34c0p

      But the following is not valid:

      Content-Type: multipart/mixed; boundary=gc0pJq0M:08jU534c0p

      (because of the colon) and must instead be represented as

      Content-Type: multipart/mixed; boundary="gc0pJq0M:08jU534c0p"

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              mkjsix Maurizio Turatti (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: