svn commit: r742156 - /couchdb/trunk/share/www/script/couch_tests.js
Author: jchris Date: Sun Feb 8 20:24:40 2009 New Revision: 742156 URL: http://svn.apache.org/viewvc?rev=742156view=rev Log: whitespace Modified: couchdb/trunk/share/www/script/couch_tests.js Modified: couchdb/trunk/share/www/script/couch_tests.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/couch_tests.js?rev=742156r1=742155r2=742156view=diff == --- couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original) +++ couchdb/trunk/share/www/script/couch_tests.js [utf-8] Sun Feb 8 20:24:40 2009 @@ -32,7 +32,7 @@ // bug COUCHDB-100: DELETE on non-existent DB returns 500 instead of 404 db.deleteDb(); -db.createDb(); +db.createDb(); // PUT on existing DB should return 412 instead of 500 xhr = CouchDB.request(PUT, /test_suite_db/);
svn commit: r742158 - in /couchdb/trunk/src/couchdb: couch_httpd.erl couch_httpd_db.erl couch_httpd_misc_handlers.erl
Author: jchris Date: Sun Feb 8 20:29:51 2009 New Revision: 742158 URL: http://svn.apache.org/viewvc?rev=742158view=rev Log: extract method couch_httpd:send_redirect(Req, Path) Modified: couchdb/trunk/src/couchdb/couch_httpd.erl couchdb/trunk/src/couchdb/couch_httpd_db.erl couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl Modified: couchdb/trunk/src/couchdb/couch_httpd.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd.erl?rev=742158r1=742157r2=742158view=diff == --- couchdb/trunk/src/couchdb/couch_httpd.erl (original) +++ couchdb/trunk/src/couchdb/couch_httpd.erl Sun Feb 8 20:29:51 2009 @@ -21,7 +21,7 @@ -export([primary_header_value/2,partition/1,serve_file/3]). -export([start_chunked_response/3,send_chunk/2]). -export([start_json_response/2, start_json_response/3, end_json_response/1]). --export([send_response/4,send_method_not_allowed/2,send_error/4]). +-export([send_response/4,send_method_not_allowed/2,send_error/4, send_redirect/2]). -export([send_json/2,send_json/3,send_json/4]). -export([default_authentication_handler/1,special_test_authentication_handler/1]). @@ -424,7 +424,9 @@ send_error(Req, Code, Error, Msg) - send_json(Req, Code, {[{error, Error}, {reason, Msg}]}). - +send_redirect(Req, Path) - +Headers = [{Location, couch_httpd:absolute_uri(Req, Path)}], +send_response(Req, 301, Headers, ). negotiate_content_type(#httpd{mochi_req=MochiReq}) - %% Determine the appropriate Content-Type header for a JSON response Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=742158r1=742157r2=742158view=diff == --- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original) +++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Sun Feb 8 20:29:51 2009 @@ -263,9 +263,8 @@ PathFront = / ++ couch_httpd:quote(binary_to_list(DbName)) ++ /, RawSplit = regexp:split(MochiReq:get(raw_path),_design%2F), {ok, [PathFront|PathTail]} = RawSplit, -RedirectTo = couch_httpd:absolute_uri(Req, PathFront ++ _design/ ++ -mochiweb_util:join(PathTail, %2F)), -couch_httpd:send_response(Req, 301, [{Location, RedirectTo}], ); +couch_httpd:send_redirect(Req, PathFront ++ _design/ ++ +mochiweb_util:join(PathTail, _design%2F)); db_req(#httpd{path_parts=[_DbName,_design,Name]}=Req, Db) - db_doc_req(Req, Db, _design/,Name/binary); Modified: couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl?rev=742158r1=742157r2=742158view=diff == --- couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl (original) +++ couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl Sun Feb 8 20:29:51 2009 @@ -50,8 +50,7 @@ couch_httpd:serve_file(Req, RelativePath, DocumentRoot); {_ActionKey, , _RelativePath} - % GET /_utils -Headers = [{Location, couch_httpd:absolute_uri(Req, /_utils/)}], -couch_httpd:send_response(Req, 301, Headers, ) +couch_httpd:send_redirect(Req, /_utils/) end; handle_utils_dir_req(Req, _) - send_method_not_allowed(Req, GET,HEAD).
[Couchdb Wiki] Update of View server by JanLehnardt
Dear Wiki user, You have subscribed to a wiki page or wiki category on Couchdb Wiki for change notification. The following page has been changed by JanLehnardt: http://wiki.apache.org/couchdb/View_server The comment on the change is: update to 0.9 -- {{{ [query_servers] - - text/javascript=/usr/local/bin/couchjs -f /usr/local/share/couchdb/server/main.js + javascript=/usr/local/bin/couchjs -f /usr/local/share/couchdb/server/main.js - text/ruby=/wherever/couchobject/bin/couch_ruby_view_requestor + ruby=/wherever/couchobject/bin/couch_ruby_view_requestor }}} == Basic API ==
[Couchdb Wiki] Trivial Update of View server by PaulDavis
Dear Wiki user, You have subscribed to a wiki page or wiki category on Couchdb Wiki for change notification. The following page has been changed by PaulDavis: http://wiki.apache.org/couchdb/View_server The comment on the change is: Missed a s/text\/javascript/javascript/ -- == The View Server == - CouchDB delegates computation of [Views] to external query servers. It communicates with them over standard input/output, using a very simple, line-based protocol. The default query server is written in Javascript, running via Mozilla !SpiderMonkey. You can use other languages by setting a MIME type in the ''language'' property of a design document or the Content-Type header of a temporary view. Design documents that do not specify a ''language'' property are assumed to be of type ''text/javascript'', as are ad hoc queries that are ''POST''ed to ''_slow_view'' without a ''Content-Type'' header. + CouchDB delegates computation of [Views] to external query servers. It communicates with them over standard input/output, using a very simple, line-based protocol. The default query server is written in Javascript, running via Mozilla !SpiderMonkey. You can use other languages by setting a MIME type in the ''language'' property of a design document or the Content-Type header of a temporary view. Design documents that do not specify a ''language'' property are assumed to be of type ''javascript'', as are ad hoc queries that are ''POST''ed to ''_slow_view'' without a ''Content-Type'' header. To register query servers with CouchDB, add a line for each server to ''couch.ini''. The basic syntax is:
svn commit: r742217 - in /couchdb/trunk: share/server/main.js src/couchdb/couch_httpd_view.erl
Author: jchris Date: Mon Feb 9 00:57:26 2009 New Revision: 742217 URL: http://svn.apache.org/viewvc?rev=742217view=rev Log: allow format query param to override accept headers for _list and _show Modified: couchdb/trunk/share/server/main.js couchdb/trunk/src/couchdb/couch_httpd_view.erl Modified: couchdb/trunk/share/server/main.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/main.js?rev=742217r1=742216r2=742217view=diff == --- couchdb/trunk/share/server/main.js [utf-8] (original) +++ couchdb/trunk/share/server/main.js [utf-8] Mon Feb 9 00:57:26 2009 @@ -142,7 +142,7 @@ // this function provides a shortcut for managing responses by Accept header respondWith = function(req, responders) { var bestKey = null, accept = req.headers[Accept]; - if (accept) { + if (accept !req.query.format) { var provides = []; for (key in responders) { if (mimesByKey[key]) { @@ -151,6 +151,8 @@ } var bestMime = Mimeparse.bestMatch(provides, accept); bestKey = keysByMime[bestMime]; + } else { +bestKey = req.query.format; } var rFunc = responders[bestKey || responders.fallback || html]; if (rFunc) { Modified: couchdb/trunk/src/couchdb/couch_httpd_view.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=742217r1=742216r2=742217view=diff == --- couchdb/trunk/src/couchdb/couch_httpd_view.erl (original) +++ couchdb/trunk/src/couchdb/couch_httpd_view.erl Mon Feb 9 00:57:26 2009 @@ -328,6 +328,9 @@ Msg1 = Bad URL query value for 'include_docs' expected \true\ or \false\., throw({query_parse_error, Msg1}) end; +{format, _} - +% we just ignore format, so that JS can have it +Args; _ - % unknown key Msg = lists:flatten(io_lib:format( Bad URL query key:~s, [Key])),