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 8650B10A1F for ; Wed, 26 Mar 2014 08:04:28 +0000 (UTC) Received: (qmail 29373 invoked by uid 500); 26 Mar 2014 08:04:27 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 28694 invoked by uid 500); 26 Mar 2014 08:04:25 -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 28414 invoked by uid 99); 26 Mar 2014 08:04:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Mar 2014 08:04:19 +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 jc.devilla@gmail.com designates 209.85.217.176 as permitted sender) Received: from [209.85.217.176] (HELO mail-lb0-f176.google.com) (209.85.217.176) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Mar 2014 08:04:15 +0000 Received: by mail-lb0-f176.google.com with SMTP id 10so1189148lbg.21 for ; Wed, 26 Mar 2014 01:03:54 -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=xILiLKXd8K6yvrdhYZ/3auBX9UKqxASvtzjmjDbgDjg=; b=KD5y1cBltrJbZhUv2OZz6pHWv+g8W9+DefHOHRzlQBlmNy4fC82BT2XsmNETeFTpqk 2wQ1gxiFni8Slg27dY7/EsAk4ZM09IN+3A6awFjJETtkCWP+IiuvIQOR9ds5j5+CbitT OZ6vrcH8Y2Z1mGZU7RWB2vd7HwxiSboSnHp8/YuyPKik5zFx321pZhMPTnm5MT6M42jf ogIrvP6BVVyU4KXc0HF/KCuP8p6sb6v00kJdk1EUtN7FVMzVLDFuzr4YuzT+gakYdyCf Baf2clGghz/5r+LJCZiiG6TdoBuoZlGJ4q1PP2bvxJQnxylq+OTiC58YKaIFQGZQvhW+ uBBg== MIME-Version: 1.0 X-Received: by 10.112.205.35 with SMTP id ld3mr9434901lbc.1.1395821033830; Wed, 26 Mar 2014 01:03:53 -0700 (PDT) Received: by 10.112.118.195 with HTTP; Wed, 26 Mar 2014 01:03:53 -0700 (PDT) In-Reply-To: References: Date: Wed, 26 Mar 2014 16:03:53 +0800 Message-ID: Subject: Re: Uploading attachments using Multipart/related From: JC de Villa To: CouchDB Mailing List Content-Type: multipart/alternative; boundary=001a11c3d864e43e4804f57de848 X-Virus-Checked: Checked by ClamAV on apache.org --001a11c3d864e43e4804f57de848 Content-Type: text/plain; charset=ISO-8859-1 Good lord. It WAS the newlines. The only hurdle I have to get over now is when uploading multiple binary attachments. But at least it's working now, and I can move on to figuring that out. Thanks Nick, Jens for the help. :) On Wed, Mar 26, 2014 at 1:46 PM, JC de Villa wrote: > Thanks everyone for looking into this. > > I just got in a few minutes ago to tinker with this again. I'll post back > once I get it working (or not... :( ) > > > On Wed, Mar 26, 2014 at 3:36 AM, Nick North wrote: > >> 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 >> > >> > >> > >> > > > > -- > JC de Villa > -- JC de Villa --001a11c3d864e43e4804f57de848--