couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Smith <...@iriscouch.com>
Subject Re: to CouchApp or not to CouchApp
Date Tue, 16 Aug 2011 13:38:17 GMT
On Tue, Aug 16, 2011 at 8:29 PM, Marcello Nuccio
<marcello.nuccio@gmail.com> wrote:
> 2011/8/16 Robert Newson <rnewson@apache.org>:
>> "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

Mime
View raw message