summaryrefslogtreecommitdiff
path: root/share/server
AgeCommit message (Collapse)Author
2010-01-26Replace the old JavaScript query server JSON library with json2.jsJohn Christopher Anderson
This change makes us interoperate better with other JSON implementations. It also means we can use the native JSON handlers in JavaScript runtimes that support them. Should be faster right away on new Spidermonkeys. There are some potential breaking changes for apps that depend on Couch blowing up on 'undefined'. json2.js serialized undefined as 'null' instead of crashing. This change will also affect people using E4X, as you can't just return an XML object and have it serialized to a string for you. Calling .toXMLString() on these is all you need to do. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@903023 13f79535-47bb-0310-9956-ffa450edef68
2009-12-23Follow RFC 2616 closer and use "verb" instead of "method"Jan Lehnardt
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@893364 13f79535-47bb-0310-9956-ffa450edef68
2009-12-22move query server to a design-doc based protocol, closes COUCHDB-589John Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@893249 13f79535-47bb-0310-9956-ffa450edef68
2009-12-12Create a new sandbox for each reset.Paul Joseph Davis
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@890008 13f79535-47bb-0310-9956-ffa450edef68
2009-12-06fix COUCHDB-593, thanks Roger Binns for reportingJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@887791 13f79535-47bb-0310-9956-ffa450edef68
2009-12-02removed add_fun optimization for filters, this provides better concurrency ↵John Christopher Anderson
at the cost of some function transfer/eval overhead, which will be optimized in a future patch. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@886334 13f79535-47bb-0310-9956-ffa450edef68
2009-08-11Initial commit of _update handler. Thanks to Paul Davis, Jason Davies for ↵John Christopher Anderson
code and others for discussion. The _update handler accepts POSTs to paths like: /db/_design/foo/_update/bar and PUTs which include docids, like: /db/_design/foo/_update/bar/docid The function signature: function(doc, req) { doc.a_new_field = req.query.something; return [doc, "<h1>added something to your doc</h1>"]; } The tests in update_documents.js are fairly complete and include examples of bumping a counter, changing only a single field, parsing from (and returning) XML, and creating new documents. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@803245 13f79535-47bb-0310-9956-ffa450edef68
2009-08-05proper handling of 406 Not Acceptable errors in list and show functionsJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@801345 13f79535-47bb-0310-9956-ffa450edef68
2009-08-05Upgraded JavaScript Accept header handling to make it useful.John Christopher Anderson
After user@ thread with Adam Jacob [1] http://tinyurl.com/kuhl2j I realized that giving users the option to set a server preference of mime-types was crucial. Without ordering, you see nasty side effects like a browser getting an Atom feed by default. With ordering, you can ensure that browsers get HTML, API clients see XML, and Ajax apps use JSON in a no-hassle way. Example new API: function(doc, req) { provides("html", function() { return "Hello " + doc.name + "."; }); provides("xml", function() { var xml = new XML('<xml></xml>'); xml.hello = doc.name; return xml; } }; If a client sends an Accept header like "application/xml, text/html" this will return html. If the client sends just "application/xml" they will get xml. respondsWith() has been removed. I don't think it's worth the cost to maintain a parallel implementation just to be deprecated as buggy. This patch also continues us on the path to a cleaner, more organized query server. Cheers and enjoy. [1] http://mail-archives.apache.org/mod_mbox/couchdb-user/200907.mbox/%3cb8602b350907241906l7c7f97fdg9d78facacd8605fd@mail.gmail.com%3e git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@801056 13f79535-47bb-0310-9956-ffa450edef68
2009-08-04Move mimeparse.js to it's own file, add to NOTICE as an external library.John Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@801018 13f79535-47bb-0310-9956-ffa450edef68
2009-07-24speed up json encoding, patch by Brian Candler, closes COUCHDB-399Jan Lehnardt
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@797548 13f79535-47bb-0310-9956-ffa450edef68
2009-07-20Initial checkin of _changes filters. The prime weak-spot for this approach ↵John Christopher Anderson
is that it maintains an OS-process per connected filtered _changes consumer. I'm pretty sure we'll be able to work around this without changing the API, but it'll involve a lot of OS-process bookkeeping. Those enhancements should generally improve show & list performance as well. Punting on them for now, first wanted to get _changes filters implemented so people could give feedback. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@795687 13f79535-47bb-0310-9956-ffa450edef68
2009-07-14wheeeeeeeeNoah Slater
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@794057 13f79535-47bb-0310-9956-ffa450edef68
2009-07-06trimmed trailing whitespaceNoah Slater
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791350 13f79535-47bb-0310-9956-ffa450edef68
2009-07-04send utf-8 hearders with list and show responses. closes COUCHDB-392John Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@791145 13f79535-47bb-0310-9956-ffa450edef68
2009-06-14merge list-iterator branch to trunk. changes JavaScript _list APIJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@784601 13f79535-47bb-0310-9956-ffa450edef68
2009-06-06truncate giant reduce overflow error outputJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@782290 13f79535-47bb-0310-9956-ffa450edef68
2009-05-04reduce_limit error is thrown when the reduce function output is not small ↵John Christopher Anderson
enough compared to the input. Errors can be switched off using the config API. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@771466 13f79535-47bb-0310-9956-ffa450edef68
2009-04-18move main.js generation to MakefileJan Lehnardt
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@766406 13f79535-47bb-0310-9956-ffa450edef68
2009-04-18add generation-noticeJan Lehnardt
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@766399 13f79535-47bb-0310-9956-ffa450edef68
2009-04-18integrate main.js split-up into build systemJan Lehnardt
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@766390 13f79535-47bb-0310-9956-ffa450edef68
2009-04-18refactor main.js into many files and improve show/list error handlingJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@766383 13f79535-47bb-0310-9956-ffa450edef68
2009-04-17output errors differently during chunked responses (view and list)John Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@765819 13f79535-47bb-0310-9956-ffa450edef68
2009-04-16Baby steps toward better reporting of os_process errors (and JavaScript ↵John Christopher Anderson
syntax errors) git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@765479 13f79535-47bb-0310-9956-ffa450edef68
2009-03-05make row_info.prev_key available on 2nd rowJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@750683 13f79535-47bb-0310-9956-ffa450edef68
2009-02-09row_info object for _list pagination. Thanks benoitc.John Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@742220 13f79535-47bb-0310-9956-ffa450edef68
2009-02-09allow format query param to override accept headers for _list and _showJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@742217 13f79535-47bb-0310-9956-ffa450edef68
2009-02-04create a separate mime registration for xhtmlJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@740925 13f79535-47bb-0310-9956-ffa450edef68
2009-02-02add iteration numbers to list row functions. closes COUCHDB-233. thanks ↵John Christopher Anderson
Benoit Chesneau. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@740094 13f79535-47bb-0310-9956-ffa450edef68
2009-01-27add toJSON to the sandboxJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@738295 13f79535-47bb-0310-9956-ffa450edef68
2009-01-27Improved etag handling for show funcs and db_doc requests; main.js cleanup ↵John Christopher Anderson
(baby steps); null doc allowed for show funcs git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@738237 13f79535-47bb-0310-9956-ffa450edef68
2009-01-24Improve show/list API and send external responses without chunked as it's ↵John Christopher Anderson
not needed. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@737304 13f79535-47bb-0310-9956-ffa450edef68
2009-01-23View list functions can stream views in any format. See list_views test for ↵John Christopher Anderson
details. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@736876 13f79535-47bb-0310-9956-ffa450edef68
2009-01-12rename _form to _show and move the funcs in the design doc to design.show.docsJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@733576 13f79535-47bb-0310-9956-ffa450edef68
2009-01-03Slight improvement in forms error logging. When this is solid I will ↵John Christopher Anderson
standardize it across main.js git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@731110 13f79535-47bb-0310-9956-ffa450edef68
2009-01-02test runner is back up (thanks davisp), and tests pass in safari again (e4x ↵John Christopher Anderson
syntax fix) git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@730656 13f79535-47bb-0310-9956-ffa450edef68
2008-12-30slightly better form error loggingJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@730248 13f79535-47bb-0310-9956-ffa450edef68
2008-12-29merge form branch to trunkJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@730016 13f79535-47bb-0310-9956-ffa450edef68
2008-12-24I agree with Damien that action.js is more than we want to support right ↵John Christopher Anderson
now. External is not activated by default, but remains available, see default.ini for details. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@729376 13f79535-47bb-0310-9956-ffa450edef68
2008-12-16action.js and testsJohn Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@727141 13f79535-47bb-0310-9956-ffa450edef68
2008-11-25Log the offending doc._id when the view function raises an exception.John Christopher Anderson
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@720389 13f79535-47bb-0310-9956-ffa450edef68
2008-11-11Check in of initial validation and authorization work. This work is ↵Damien F. Katz
incomplete, as there is not yet any way of restricting who can update the design docs. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@713132 13f79535-47bb-0310-9956-ffa450edef68
2008-08-08COUCHDB-103 Fixed incompatibilty with new javascript (1.8) that no longer ↵Damien F. Katz
supports sealing document, making them immutable. The problem is arrays can no longer be sealed, and an error is generated when it is attempted. The fix here is to simply remove the document sealing, and map function placed in the same design document will have to be trustworthy that they don't modify the document (the same document is passed to multiple map functions). Non-trustworthy map functions can be placed in their own design documents, they will be run in isolation. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@684023 13f79535-47bb-0310-9956-ffa450edef68
2008-06-23Follow fixes to r670732 for COUCHDB-83.Christopher Lenz
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@670737 13f79535-47bb-0310-9956-ffa450edef68
2008-06-23Improve error handling for undefined values emitted by map functions. Closes ↵Christopher Lenz
COUCHDB-83. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@670732 13f79535-47bb-0310-9956-ffa450edef68
2008-06-23Follow-up to r670653: Implement deep sealing in Javascript as using the ↵Christopher Lenz
native `JS_SealObject` function in deep mode somehow also locked down outer scopes, leading to various obscure errors. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@670720 13f79535-47bb-0310-9956-ffa450edef68
2008-06-23Seal the document in Javascript view functions in 'deep' mode so that it's ↵Christopher Lenz
not possible to modify values in nested arrays and objects. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@670653 13f79535-47bb-0310-9956-ffa450edef68
2008-06-09Changed name of 'combine' phase of reduce to 'rereduce', to avoid confusion.Damien F. Katz
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@665852 13f79535-47bb-0310-9956-ffa450edef68
2008-05-26Applied patch to enable logging from Javascript view functions. Closes ↵Christopher Lenz
COUCHDB-59. Thanks to Chris Anderson for the patch. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@660140 13f79535-47bb-0310-9956-ffa450edef68
2008-05-23fix for bug with reusing map btree indexes when multiple views have the same ↵Damien F. Katz
map function git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@659596 13f79535-47bb-0310-9956-ffa450edef68