Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E3B1D10E96 for ; Tue, 25 Mar 2014 19:37:08 +0000 (UTC) Received: (qmail 60306 invoked by uid 500); 25 Mar 2014 19:37:07 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 60229 invoked by uid 500); 25 Mar 2014 19:37:05 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 60219 invoked by uid 99); 25 Mar 2014 19:37:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2014 19:37:05 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of north.n@gmail.com designates 209.85.220.52 as permitted sender) Received: from [209.85.220.52] (HELO mail-pa0-f52.google.com) (209.85.220.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Mar 2014 19:37:01 +0000 Received: by mail-pa0-f52.google.com with SMTP id rd3so890117pab.25 for ; Tue, 25 Mar 2014 12:36:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=r9tyVd1RKnM7gbW/hQ+jjT+SJPPNu0ascHQ6sXKa3aQ=; b=Sw3GJIowDxL/fercw3nDso0449A/qKMR751G4jPbgYw/eVYh+RGDYt6NUsnU7jbzDU IIqpBvgwM79vDriaGGsc7FfQeKq1HXOLY57ehjS9vCxIwKGEPmdiHM3nC2sueJLWZMOi +A4t1zHzXkRbyYJvP3qe6f3svvbc4XIr9u6BKIFIjAA6SLmzXWGAF8WR+9H16CRAyOL3 FTr1S8aOAxGklW7fLpK1RWVxkrkOwYajbn2EIEUiVsMyE+w8QqbJ+CT4nnvyRQh4WO70 Klgm4Eo0IXln2cj3iFwo5APQwXddE8xM4XB974kmBYqe/IATRJLSFl72LbH/qnfL1fM8 UeSw== MIME-Version: 1.0 X-Received: by 10.68.2.99 with SMTP id 3mr81201840pbt.49.1395776200578; Tue, 25 Mar 2014 12:36:40 -0700 (PDT) Received: by 10.68.73.135 with HTTP; Tue, 25 Mar 2014 12:36:40 -0700 (PDT) In-Reply-To: References: Date: Tue, 25 Mar 2014 19:36:40 +0000 Message-ID: Subject: Re: Uploading attachments using Multipart/related From: Nick North To: "user@couchdb.apache.org" Content-Type: multipart/alternative; boundary=bcaec521594d9f1c7a04f5737835 X-Virus-Checked: Checked by ClamAV on apache.org --bcaec521594d9f1c7a04f5737835 Content-Type: text/plain; charset=ISO-8859-1 Following up on my last message: the final newline is no longer required. You could take a look at https://gist.github.com/NorthNick/9769261 - this is a dump of a request that works on CouchDb 1.5 for me. As Jens says, the crucial difference may well be in the use of CRLF around the boundary. The first boundary string is preceded by CRLFCRLF and followed by CRLF; the later ones are preceded by CRLF and followed by CRLFCRLF. Nick On 25 March 2014 19:03, Nick North wrote: > The "chunked" problem is fixed in branch 1956-attachment-handling, but I'm > not sure if that is ready to merge yet, so you're right that it is still a > problem at the moment. > > I also vaguely recall the final CRLF problem, and have a feeling it was > patched a while back, but I'm not completely sure. I'll check.... > > The MIME headers are still ignored. I'd like to sort this out, but it > raises a host of questions about backward-compatibility, and what to do if > there is a mixture of _attachments entries and MIME headers, especially if > they are incompatible with each other. I haven't got around to thinking out > a proposal for answering those questions yet. > > Nick > > > On 25 March 2014 18:40, Jens Alfke wrote: > >> >> On Mar 25, 2014, at 7:37 AM, JC de Villa wrote: >> >> > This is absolutely driving me nuts. >> > I'm sure it's easy. Uploading multiple attachments just don't seem to >> want to work for me. >> >> This sounds like my experience getting my replicator to interoperate with >> CouchDB a few years ago :) >> >> Here's a brain dump of things I remember: >> >> * Make sure the line breaks in the MIME separators/headers are CRLF, not >> just LF! >> * CouchDB crashes if a multipart body is sent in HTTP 'chunked' mode >> (COUCHDB-1403, filed by me two years ago and still unresolved. My colleague >> working on the Java port of my replicator just ran into this a few weeks >> ago.) >> * I remember there being a bug in CouchDB where it required a CRLF after >> the closing MIME separator, i.e. the body had to end "--separator--\r\n" >> not just "--separator--") but I can't find a reference to the bug in my >> source code anymore. It may have been fixed. >> * CouchDB used to ignore the headers in attachment MIME parts and assumed >> that the attachments appeared in the same order as in the "_attachments" >> object in the main JSON body. I believe this has been fixed and that it now >> looks at the Content-Disposition header to find the attachment's filename, >> but I can't remember for sure. >> >> Hope this helps! >> >> --Jens > > > --bcaec521594d9f1c7a04f5737835--