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 CD54386C2 for ; Tue, 16 Aug 2011 16:06:26 +0000 (UTC) Received: (qmail 87952 invoked by uid 500); 16 Aug 2011 16:06:23 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 87804 invoked by uid 500); 16 Aug 2011 16:06:22 -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 87794 invoked by uid 99); 16 Aug 2011 16:06:21 -0000 Received: from minotaur.apache.org (HELO minotaur.apache.org) (140.211.11.9) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2011 16:06:21 +0000 Received: from localhost (HELO mail-iy0-f174.google.com) (127.0.0.1) (smtp-auth username rnewson, mechanism plain) by minotaur.apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Aug 2011 16:06:21 +0000 Received: by iyf40 with SMTP id 40so106404iyf.5 for ; Tue, 16 Aug 2011 09:06:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.84.18 with SMTP id h18mr8456903ibl.12.1313510780883; Tue, 16 Aug 2011 09:06:20 -0700 (PDT) Received: by 10.231.155.129 with HTTP; Tue, 16 Aug 2011 09:06:20 -0700 (PDT) In-Reply-To: References: <4E371B93.8060303@kearns.net.au> Date: Tue, 16 Aug 2011 17:06:20 +0100 Message-ID: Subject: Re: to CouchApp or not to CouchApp From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Talk of 'following the standard' while preserving the behavior of returning a 302 for an unauthorized request is contradictory. We're deliberately not following the standard 401 response here because the universal user agent behavior we'd get is unpalatable. Following the standard for content-type negotiation is still broken for browsers (like IE) that regard html and json as exactly equally preferable. We could just agree that this negotiation is broken on IE and follow the original proposal in the ticket (to account for q-values correctly). I've no idea if that's acceptable but it doesn't sound likely. B. On 16 August 2011 16:47, Marcello Nuccio wrote: > 2011/8/16 Jason Smith : >> On Tue, Aug 16, 2011 at 9:30 PM, Marcello Nuccio >> wrote: >>> Since sketch.png is available only as "image/png", Apache responds >>> with "image/png" even if "image/jpeg" is preferred according to the >>> Accept header. >>> >>>>> This is what I do if the user is authenticated, and I see no reason >>>>> for not doing it when the response is a 401. >>>> >>>> i don't follow. how it is related? >>> >>> >>> I ask to apply the same logic whatever the status code of the >>> response. If when the response is "200 OK" the content-type is >>> "text/html", then why not respond with the same content-type for a >>> "401 Unauthorized" response? >>> >>> Obviously the content will be different (an html login form for the 401). >> >> Did you see my previous two emails? Quick summary: >> >> 1. That is not the standard. IMHO, if CouchDB should change, it should >> change toward the standard. >> 2. Regardless of #1, it is hard to implement. The example of a public >> image is not the question. The question is you request *something* but >> you do not have permission. How should Couch respond? To me, the >> answer is becoming very clear: obey the client Accept header. If the >> client explicitly asks for HTML, send a 302 bounce; otherwise send 401 >> JSON. If that breaks futon or some applications, we can fix those >> as-needed once and for all. > > Saying it is hard to implement could be enough reason for not doing > it. However it would be great to first find the "right" solution, and > then say "ok, maybe some day we could do it, but for now the best > workaround is...". > > Why do you say it is not the standard? > I am NOT saying to ignore the Accept header. Nothing of what I have > said makes CouchDB less standard compliant. > > Sending 302 instead of 401, is not more standard-compliant than > sending 401 with the correct content-type. > > Sorry, but I think I am missing something obvious... > > Marcello >