CouchDB
  1. CouchDB
  2. COUCHDB-1632

Epilogue area in MIME multipart_related docs is not ignored

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.4.0
    • Component/s: HTTP Interface
    • Labels:
      None

      Description

      When PUTting a document with attachments in MIME multipart/related format, CouchDB (1.2.0 on Mac OS X) throws a badmatch error in doc_from_multi_part_stream() if any bytes are following the final boundary.

      For example, if the last body part ends with

      \r\n==1234==\r\nabc

      the error reads

      [error] [emulator] Error in process <0.18266.with exit value: badmatch,{<<7 bytes>>, #Fun<couch_httpd_db.23.117176975>,ok,[{couch_doc,'doc_from_multi_part_stream/2-fun-1',3,[

      {file,"/Users/hs/prj/build-couchdb/dependencies/couchdb/src/couchdb/couch_doc.erl"}

      ,

      {line,512}

      ]}]}

      where <<7 bytes>> is 2 + the number of bytes following the two ending hyphens (5 in this example). Everything works fine if the last body part ends with two hyphens only (i.e. the epilogue is left blank).

      However, according to RFC 1521 Sec. 7.2.1 (<http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html>), "implementations should ignore anything that appears before the first boundary or after the last one".

      --Peter

      Confirmations:

      On 18.12.201, 18:48 Jens Alfke <jens@couchbase.com>:

      > When PUTting a document with attachments in MIME multipart/related format, CouchDB (1.2.0 on Mac
      > OS X) throws a badmatch error in doc_from_multi_part_stream() if any bytes are following the final boundary.

      Confirmed; I ran into this as well, while implementing TouchDB, but was too lazy to file a bug report. Don’t repeat my mistake!

      Judging by activity on some other bugs I did report, the multipart code is being cleaned up for 1.3, so maybe they can get to this too.

      —Jens

        Activity

        Hide
        Simon added a comment - - edited

        Same problem here when trying to create a new document with attachments using the multipart/related functionality described here: http://wiki.apache.org/couchdb/HTTP_Document_API#Multiple_Attachments

        I am using the version 1.2.0 on mac os x

        Show
        Simon added a comment - - edited Same problem here when trying to create a new document with attachments using the multipart/related functionality described here: http://wiki.apache.org/couchdb/HTTP_Document_API#Multiple_Attachments I am using the version 1.2.0 on mac os x
        Robert Newson made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.4 [ 12323451 ]
        Resolution Fixed [ 1 ]
        Peter Keller made changes -
        Affects Version/s 1.2 [ 12315198 ]
        Peter Keller made changes -
        Field Original Value New Value
        Priority Major [ 3 ] Minor [ 4 ]
        Peter Keller created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Peter Keller
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development