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 44E698035 for ; Tue, 16 Aug 2011 16:48:50 +0000 (UTC) Received: (qmail 71500 invoked by uid 500); 16 Aug 2011 16:48:48 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 71407 invoked by uid 500); 16 Aug 2011 16:48:47 -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 71399 invoked by uid 99); 16 Aug 2011 16:48:47 -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:48:47 +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:48:47 +0000 Received: by iyf40 with SMTP id 40so188445iyf.5 for ; Tue, 16 Aug 2011 09:48:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.2.194 with SMTP id 2mr8520141ibk.38.1313513326606; Tue, 16 Aug 2011 09:48:46 -0700 (PDT) Received: by 10.231.155.129 with HTTP; Tue, 16 Aug 2011 09:48:46 -0700 (PDT) In-Reply-To: References: <4E371B93.8060303@kearns.net.au> Date: Tue, 16 Aug 2011 17:48:46 +0100 Message-ID: Subject: Re: to CouchApp or not to CouchApp From: Robert Newson To: user@couchdb.apache.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable a 401 response MUST include a WWW-Authenticate header, this causes an unstylable modal dialog box on all browsers (the HTML you want to send will not matter). This is why we cannot do as you suggest. B. On 16 August 2011 17:45, Marcello Nuccio wrote: > 2011/8/16 Jens Alfke : >> >> On Aug 16, 2011, at 9:16 AM, Marcello Nuccio wrote: >> >>> Ignoring for an instant that this is hard to implement, as Jason says. >>> What is the problem if I send an HTML response, if the requested >>> resource is HTML? >> >> Because if the client requesting the HTML is not a user-facing web brows= er, the 302 is the wrong response, because the client won=92t know what to = do with the resulting login form (unless it does screen-scraping.) I=92ve a= lready run into this in implementing my CouchCocoa framework. > > > I am not saying to respond with 302. I am saying: > > =A0- ALWAYS respond with 401 > =A0- IF the Accept header says "text/html" is a valid response AND the > requested resource is of type "text/html", THEN send HTML in the body > of the response, ELSE send JSON. > > Never send 302 instead of 401. > Never send HTML if not "accepted" by the client and it is the type of > the requested resource. > > Why is this not standard compliant? > > Marcello >