From user-return-10726-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Fri May 28 14:03:26 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 13661 invoked from network); 28 May 2010 14:03:26 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 28 May 2010 14:03:26 -0000 Received: (qmail 88934 invoked by uid 500); 28 May 2010 14:03:25 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 88817 invoked by uid 500); 28 May 2010 14:03:24 -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 88809 invoked by uid 99); 28 May 2010 14:03:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 May 2010 14:03:24 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jchris@gmail.com designates 209.85.160.52 as permitted sender) Received: from [209.85.160.52] (HELO mail-pw0-f52.google.com) (209.85.160.52) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 May 2010 14:03:15 +0000 Received: by pwi10 with SMTP id 10so722830pwi.11 for ; Fri, 28 May 2010 07:02:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:content-type:mime-version :subject:from:in-reply-to:date:content-transfer-encoding:message-id :references:to:x-mailer; bh=Cu/T6VeAWY5+Pfd59vZE6S2n1DBHDBp++sws009u7Is=; b=Q82PWYq7LAZ6F4Z/0vxtONd4pSSJ/fKpfwLlDH1rVBSOCVv/8Q7rc/fsOE6InHeqZX X2ykOID0SWv5b9UvfZ044SFB6Bw2RwbUMV/LGgig7iaulEn9FAJqUqxEtppr1vVOi+N+ 2M0+iZvaD39hOfylZeb0nyeWCua42cs+Ammo4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; b=Eh9/Sap/Xjn0KrcI48LJkmtEmfWcBpqfk9/5DHu3ztQlYlL7pGGx8SgnvrgaheMDTn 2fsZsQQg6dVUmFyQ/iFITIc80nAr5tPNLpbtqzm9E3J7RHHHEsStY6M4A0V9UPI+OHnB VBcMTPlB6IZzEb2j7wGr6oWOGD1jZtSb6Z7o0= Received: by 10.141.106.14 with SMTP id i14mr224755rvm.259.1275055373303; Fri, 28 May 2010 07:02:53 -0700 (PDT) Received: from [192.168.1.101] (c-98-248-172-14.hsd1.ca.comcast.net [98.248.172.14]) by mx.google.com with ESMTPS id d14sm2074314rva.6.2010.05.28.07.02.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 28 May 2010 07:02:52 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1078) Subject: Re: deliver attachment in show function? From: J Chris Anderson In-Reply-To: <4BFFA740.6080109@hotornot.de> Date: Fri, 28 May 2010 07:02:49 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <1134FCAE-2103-43DF-8AAA-EC8B3D8F0764@gmail.com> References: <4BFFA1E4.4040104@hotornot.de> <4BFFA740.6080109@hotornot.de> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1078) X-Virus-Checked: Checked by ClamAV on apache.org On May 28, 2010, at 4:21 AM, Jan Prieser wrote: > Even more confusing: > GET /images/a0cbe43b55828d33320cf6cbd40bdb81?attachments=3Dtrue > does include the data part base84 encoded >=20 > and return { > base64: --data; > } > works as well. >=20 > why is the combination of those not possible? >=20 It's possible, it's just that we avoid shipping the attachments to the = query server, because in most cases that would slow things down a lot. = It could be possible to patch couchdb to allow you to pass attachments = to show functions. (but it'd still be slow) > Jan >=20 > Am 28.05.2010 13:10, schrieb Robert Newson: >> Attachments aren't available through show functions. JSON and binary >> don't place nicely together. What makes it a little more confusing is >> that you'll see the _attachments object in your document with >> everything *except* the data. :) >>=20 >> B. >>=20 >> On Fri, May 28, 2010 at 11:58 AM, Jan Prieser = wrote: >>> Hi, >>>=20 >>> is it possible to deliver an attachment through a show function? >>> i've tried this with no success: >>> GET >>> = /images/_design/images/_show/onlineimage/a0cbe43b55828d33320cf6cbd40bdb81?= attachments=3Dtrue >>>=20 >>> function (doc, req) { >>> if (doc.type =3D=3D "image"&& doc.online =3D=3D "online") { >>> return { >>> body: doc._attachments["filename"].data, >>> headers: { "content-type" : >>> doc._attachments["filename"].content_type} >>>=20 >>> } >>> } >>> else { >>> return 'not found or offline'; >>> } >>> } >>>=20 >>> Reason is to rewrite this URL in varnish cache and only deliver = images which >>> are flagged online in doc.online. >>> My application would ask for http://varnish/image/ and = only get >>> online images. >>> I'm trying to avoid an extra http roundtrip through the application = server. >>>=20 >>> any ideas how to accomplish this scenario? >>>=20 >>> regards, >>> jan prieser >>>=20