Return-Path: Delivered-To: apmail-incubator-couchdb-commits-archive@locus.apache.org Received: (qmail 39521 invoked from network); 18 May 2008 12:29:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 May 2008 12:29:19 -0000 Received: (qmail 99406 invoked by uid 500); 18 May 2008 12:29:20 -0000 Delivered-To: apmail-incubator-couchdb-commits-archive@incubator.apache.org Received: (qmail 99386 invoked by uid 500); 18 May 2008 12:29:20 -0000 Mailing-List: contact couchdb-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-dev@incubator.apache.org Delivered-To: mailing list couchdb-commits@incubator.apache.org Received: (qmail 99377 invoked by uid 99); 18 May 2008 12:29:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 May 2008 05:29:20 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 18 May 2008 12:28:42 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 1441F23889FA; Sun, 18 May 2008 05:28:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r657552 - /incubator/couchdb/trunk/src/couchdb/couch_httpd.erl Date: Sun, 18 May 2008 12:28:57 -0000 To: couchdb-commits@incubator.apache.org From: jan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080518122858.1441F23889FA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jan Date: Sun May 18 05:28:57 2008 New Revision: 657552 URL: http://svn.apache.org/viewvc?rev=657552&view=rev Log: - more graceful handling of unknown private URIs including more user friendly messages - add a proper comment to the descending=false handling Modified: incubator/couchdb/trunk/src/couchdb/couch_httpd.erl Modified: incubator/couchdb/trunk/src/couchdb/couch_httpd.erl URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=657552&r1=657551&r2=657552&view=diff ============================================================================== --- incubator/couchdb/trunk/src/couchdb/couch_httpd.erl (original) +++ incubator/couchdb/trunk/src/couchdb/couch_httpd.erl Sun May 18 05:28:57 2008 @@ -96,6 +96,8 @@ {ok, Req:respond({301, [{"Location", "/_utils/"}], <<>>})}; "/_utils/" ++ PathInfo -> {ok, Req:serve_file(PathInfo, DocumentRoot)}; + "/_" ++ UnknownPrivatePath -> + handle_unkown_private_uri_request(Req, Method, UnknownPrivatePath); _Else -> handle_db_request(Req, Method, {Path}) end. @@ -129,6 +131,19 @@ handle_replicate_request(_Req, _Method) -> throw({method_not_allowed, "POST"}). +handle_unkown_private_uri_request(Req, _Method, UnknownPrivatePath) -> + KnownPrivatePaths = ["_utils"], + Msg = {obj, + [ + {error, "Sorry, we could not find the private path '_" ++ + mochiweb_util:unquote(UnknownPrivatePath) ++ + "' you are looking for. We only know about the following path(s): '" ++ + lists:flatten(KnownPrivatePaths) ++ "'"} + ] + }, + io:format("Debug: ~p~n", [Msg]), + send_error(Req, 404, Msg). + % Database request handlers handle_db_request(Req, Method, {Path}) -> @@ -631,7 +646,10 @@ Args %already reversed end; {"descending", "false"} -> - % ignore + % The descending=false behaviour is the default behaviour, so we + % simpply ignore it. This is only for convenience when playing with + % the HTTP API, so that a user doesn't get served an error when + % flipping true to false in the descending option. Args; {"skip", Value} -> case (catch list_to_integer(Value)) of