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 A7FAC8A54 for ; Tue, 16 Aug 2011 13:39:06 +0000 (UTC) Received: (qmail 4758 invoked by uid 500); 16 Aug 2011 13:39:05 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 4691 invoked by uid 500); 16 Aug 2011 13:39:04 -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 4683 invoked by uid 99); 16 Aug 2011 13:39:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2011 13:39:04 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.218.52] (HELO mail-yi0-f52.google.com) (209.85.218.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2011 13:38:58 +0000 Received: by yie13 with SMTP id 13so5551397yie.11 for ; Tue, 16 Aug 2011 06:38:37 -0700 (PDT) Received: by 10.42.152.8 with SMTP id g8mr3050236icw.211.1313501917147; Tue, 16 Aug 2011 06:38:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.173.1 with HTTP; Tue, 16 Aug 2011 06:38:17 -0700 (PDT) In-Reply-To: References: <4E371B93.8060303@kearns.net.au> From: Jason Smith Date: Tue, 16 Aug 2011 20:38:17 +0700 Message-ID: Subject: Re: to CouchApp or not to CouchApp To: user@couchdb.apache.org Content-Type: text/plain; charset=UTF-8 On Tue, Aug 16, 2011 at 8:29 PM, Marcello Nuccio wrote: > 2011/8/16 Robert Newson : >> "The only requirement is: if I ask an HTML, give me an HTML, not a JSON." >> >> If only it were that simple. How about, as in the case for IE, both >> HTML and JSON are exactly equally acceptable? 1.0.x would send HTML, >> 1.1.x will send JSON. Both are wrong depending on what you wanted. >> Empasse. > > Sorry, I said it wrong. > > What I wanted to say is: > if I request a resource with a mime-type of "text/html", I expect the > response to be "text/html", if the Accept header says "text/html" is > an acceptable format. In this case the value of "q" is not relevant > because we only have the resource in HTML format. Regardless of the merits of your request, I can tell you that the way the code works makes this tough to implement. Read access is done per-database, not per document, or per attachment, or anything else. Therefore, CouchDB checks whether you have permission around the time it is opening the database file, i.e. before it even starts digging for your document or your document attachment. In other words, when CouchDB decides you don't have permission, it has no idea what mime-type your resource would have been. Considering this reality (and you can see my opinion in my email a few minutes ago), I personally am inclined to fall back to the standards. Follow the q value rules. Then, if application developers have difficulty, at least they say to themselves "well, CouchDB is following the rules. Now what to do?" -- Iris Couch