Russell Branca [Mon, 12 Oct 2015 19:26:30 +0000 (19:26 +0000)]
Whitespace and housekeeping
Russell Branca [Mon, 12 Oct 2015 19:26:05 +0000 (19:26 +0000)]
Add specs to document validate_doc_update/5
Russell Branca [Tue, 29 Sep 2015 20:32:02 +0000 (20:32 +0000)]
Add revs limit for docs passed to filter functions
The existing revs_limit logic only accounts for depth of individual
branches, and ignores the case where you have a lot of branches, for
instance when a doc is heavily conflicted. This patch truncates the list
of revs when passing docs to the JS filter functions, because given
enough revs this can cause the couchjs processes to explode.
Robert Newson [Wed, 23 Sep 2015 16:52:53 +0000 (17:52 +0100)]
Fix crypto deprecations
COUCHDB-2825
Alexander Shorin [Thu, 17 Sep 2015 20:02:28 +0000 (23:02 +0300)]
Use illegal_docid error for really bad document ids
Robert Newson [Thu, 17 Sep 2015 11:48:07 +0000 (12:48 +0100)]
Use lists:ukeymerge to simplify header deduplication
Modifies COUCHDB-1876 patch
Artur Mazurek [Mon, 25 May 2015 14:19:53 +0000 (15:19 +0100)]
Fix duplicated Content-Type for show/update functions
When a show/update function returned data it added a
"Content-Type: application/json" header by itself. Then
couch_httpd added some default headers (including a yet
another "application/json" one).
This diff will add default chttpd headers only when
same headers are not yet present in the response.
This closes #55
COUCHDB-1876
Signed-off-by: Alexander Shorin <kxepal@apache.org>
Robert Newson [Thu, 10 Sep 2015 12:59:08 +0000 (13:59 +0100)]
Merge remote-tracking branch 'cloudant/remove-csrf'
Robert Newson [Thu, 10 Sep 2015 11:27:17 +0000 (12:27 +0100)]
Remove new CSRF mechanism
Robert Newson [Thu, 10 Sep 2015 11:27:17 +0000 (12:27 +0100)]
Remove new CSRF mechanism
Joan Touzet [Wed, 9 Sep 2015 18:41:03 +0000 (14:41 -0400)]
Add libcurl support for Windows
Robert Newson [Mon, 7 Sep 2015 12:05:47 +0000 (13:05 +0100)]
Convert compilation error to 400 Bad Request
COUCHDB-2772
Robert Newson [Thu, 3 Sep 2015 20:42:47 +0000 (21:42 +0100)]
Restrict CSRF check to specific mime types
COUCHDB-2797
Robert Newson [Thu, 3 Sep 2015 15:29:03 +0000 (16:29 +0100)]
Merge remote-tracking branch 'cloudant/2775-post-valid-json-header'
Mayya Sharipova [Wed, 2 Sep 2015 17:33:29 +0000 (13:33 -0400)]
check POST requests for valid json header
validate that all POST requests with json body must have also have valid
json header: {"Content-Type": "application/json"}
This ensures a basic protection against CSRF
JIRA: COUCHDB-2775
ILYA Khlopotov [Wed, 2 Sep 2015 16:47:56 +0000 (09:47 -0700)]
Register service
COUCHDB-2796
ILYA Khlopotov [Tue, 1 Sep 2015 13:23:57 +0000 (06:23 -0700)]
Remove `ignore_providers` option
COUCHDB-2796
Robert Newson [Thu, 27 Aug 2015 20:22:17 +0000 (21:22 +0100)]
Capture histogram data for _bulk_requests
COUCHDB-2792
Eric Avdey [Mon, 24 Aug 2015 13:55:30 +0000 (10:55 -0300)]
Fix crashing filtered _changes request
A filtered call to _changes end-point prompts a node to
pull a peer from the received mochi request record.
This is crashing on the secondary nodes in a clustered
environment since the peer call made on a socket
that is not original for them.
The fix makes use of the fact that by the time of the request
the peer already got resolved on the coordinator node and
passed along as a part of #http record.
This closes the case COUCHDB-2785
Alexander Shorin [Sun, 23 Aug 2015 11:22:46 +0000 (14:22 +0300)]
No, etap, we don't need in your services anymore
Alexander Shorin [Fri, 21 Aug 2015 08:14:28 +0000 (11:14 +0300)]
Bind both to IPv4 and IPv6 with special "any" value
This also removes need in special wrapper to handle atom as default
for config:get call.
COUCHDB-2783
Klaus Trainer [Tue, 18 Aug 2015 17:02:53 +0000 (19:02 +0200)]
Remove duplicate `couch_epi` from couch.app.src
Robert Newson [Mon, 17 Aug 2015 19:29:45 +0000 (20:29 +0100)]
Log when password is wrong but user is valid
COUCHDB-2777
Robert Newson [Sat, 15 Aug 2015 11:47:44 +0000 (12:47 +0100)]
Align csrf cookie refresh with authsession cookie refresh
Robert Newson [Wed, 12 Aug 2015 20:30:33 +0000 (21:30 +0100)]
Merge remote-tracking branch 'cloudant/47059_session_accept_username'
ILYA Khlopotov [Wed, 12 Aug 2015 16:25:30 +0000 (09:25 -0700)]
Implement rename_on_delete
Sometimes it is usefull to keep deleted db files around. For backup
reasons for example. This commit implements the feature. The feature is
enabled by specifying `rename_on_delete = true` in `[couchdb]` of the
config.
Mayya Sharipova [Thu, 23 Jul 2015 19:04:43 +0000 (15:04 -0400)]
Make _session endpoint accept username in addition to name
Before _session endpoint was only accepting "name" and "password" parameters
This, makes _session endpoint, in addition, to accept "username" and
"password" parameters
JIRA: COUCHDB-2754
BugzId: 47059
ILYA Khlopotov [Tue, 11 Aug 2015 20:38:01 +0000 (13:38 -0700)]
Add couch_db_plugin:on_delete/2
ILYA Khlopotov [Wed, 5 Aug 2015 20:45:35 +0000 (13:45 -0700)]
Tests for 'authentication_handlers' and 'authenticated' on '_session'
ILYA Khlopotov [Wed, 5 Aug 2015 17:46:33 +0000 (10:46 -0700)]
Don't do pointless conversion of dbname into list
ILYA Khlopotov [Wed, 5 Aug 2015 15:23:27 +0000 (08:23 -0700)]
Make sure we start `setup` app in test
ILYA Khlopotov [Fri, 31 Jul 2015 18:16:23 +0000 (11:16 -0700)]
Return `{error, {illegal_database_name, Name}}`
ILYA Khlopotov [Fri, 19 Jun 2015 18:07:07 +0000 (11:07 -0700)]
Export couch_db:is_admin/1
ILYA Khlopotov [Fri, 19 Jun 2015 17:58:35 +0000 (10:58 -0700)]
Add couch_db_plugin:check_is_admin/1
ILYA Khlopotov [Fri, 19 Jun 2015 17:50:58 +0000 (10:50 -0700)]
Add couch_db_plugin:validate_docid/1
ILYA Khlopotov [Fri, 19 Jun 2015 17:47:05 +0000 (10:47 -0700)]
Add couch_db_plugin:after_doc_read/2
ILYA Khlopotov [Fri, 19 Jun 2015 17:41:32 +0000 (10:41 -0700)]
Add couch_db_plugin:before_doc_update/2
ILYA Khlopotov [Fri, 19 Jun 2015 17:32:39 +0000 (10:32 -0700)]
Add couch_db_plugin:validate_dbname/2
ILYA Khlopotov [Wed, 29 Jul 2015 19:13:13 +0000 (12:13 -0700)]
Update `#chttpd{}` record
ILYA Khlopotov [Wed, 29 Jul 2015 19:11:50 +0000 (12:11 -0700)]
Don't guess authentication handler name
Robert Newson [Mon, 10 Aug 2015 18:09:29 +0000 (19:09 +0100)]
CSRF is not necessary for read operations
COUCHDB-2762
Robert Newson [Sat, 8 Aug 2015 13:03:23 +0000 (14:03 +0100)]
Add option to make CSRF cookie mandatory
When enabled, the CSRF cookie/header is required on all requests
except those to the welcome message at /.
COUCHDB-2762
Robert Newson [Sat, 8 Aug 2015 12:27:17 +0000 (13:27 +0100)]
change couch_httpd_csrf section to csrf
Robert Newson [Fri, 31 Jul 2015 15:25:36 +0000 (16:25 +0100)]
Add CSRF protection
If the request parameter `csrf` is set to `true` when successfully
acquiring a session cookie from `_session` an additional cookie
(`Csrf-token`) is returned. All requests that send this new cookie
must also send a header (`X-Csrf-Token`) with the same value. If the
cookie is sent and the header is missing or different, a 403 response
is generated.
Note that the CSRF token is signed by the server so tampering is
detected and also results in a 403 response.
closes COUCHDB-2762
ILYA Khlopotov [Mon, 27 Jul 2015 17:13:45 +0000 (10:13 -0700)]
Avoid arithmetic in `to_hex` function
Robert Newson [Tue, 21 Jul 2015 13:30:48 +0000 (14:30 +0100)]
Merge remote-tracking branch 'cloudant/dont-validate-host-by-default'
Robert Newson [Tue, 21 Jul 2015 12:33:37 +0000 (13:33 +0100)]
Merge remote-tracking branch 'cloudant/dynamic-handlers'
Robert Newson [Tue, 21 Jul 2015 09:19:27 +0000 (10:19 +0100)]
Don't enable host validation by default
Revising original stance. Administrators can enable this feature if
they want, and supply the definitive list of allowed Host values.
When enabled, the default list of valid hosts is empty.
COUCHDB-2752
Robert Newson [Mon, 20 Jul 2015 13:03:49 +0000 (14:03 +0100)]
Merge remote-tracking branch 'cloudant/2752-validate-host'
Robert Newson [Fri, 17 Jul 2015 16:51:59 +0000 (17:51 +0100)]
Validate host header
By default, the Host header must be either localhost or the
fully-qualified domain name of the host.
Administrators can disable this check with;
[httpd]
validate_host = false
Administrators can override the valid host list with;
[httpd]
valid_hosts = foo,bar,baz
COUCHDB-2752
NickNorth [Sun, 19 Jul 2015 08:56:23 +0000 (09:56 +0100)]
Support Windows compilation for couch_ejson_compare
MSVC uses __declspec(thread) rather than __thread, so created a macro for it.
Adam Kocoloski [Sat, 18 Jul 2015 15:58:19 +0000 (11:58 -0400)]
Merge branch '2735-duplicate-docs'
Adam Kocoloski [Sat, 18 Jul 2015 11:49:00 +0000 (07:49 -0400)]
Ensure doc groups are sorted before merging them
We had been implicitly assuming that clients send us sorted groups, but
unsurprisingly that's not always the case. The additional sorting here
should be redundant, but the consequences of merging unsorted groups are
severe -- we can end up with uniqueness violations on the primary key in
the database -- and so we add an additional sort here.
COUCHDB-2735
ILYA Khlopotov [Fri, 17 Jul 2015 17:59:06 +0000 (10:59 -0700)]
Use dynamic handler for `_oauth`
ILYA Khlopotov [Wed, 15 Jul 2015 15:04:52 +0000 (08:04 -0700)]
Add dynamic http endpoints
Robert Newson [Fri, 17 Jul 2015 16:52:31 +0000 (17:52 +0100)]
Merge remote-tracking branch 'cloudant/2732-optimize-couch-ejson-compare'
Joan Touzet [Fri, 17 Jul 2015 04:18:02 +0000 (00:18 -0400)]
Merge branch 'windows_support'
Joan Touzet [Sat, 11 Jul 2015 23:38:38 +0000 (19:38 -0400)]
Support Windows build target
Eric Avdey [Wed, 24 Jun 2015 14:50:39 +0000 (11:50 -0300)]
Remove compression's optimization
When a file compression set to snappy, couch is doing an additional
optimization step by also compressing the term with deflate,
comparing the sizes of the result binary and choosing the smaller one.
This leads to a situation when for snappy compresed database the
'winning' deflate compressed term got decompressed and compressed
back into deflate on each document's write.
This patch removes this compression's optimization.
[Basic test](http://nbviewer.ipython.org/gist/eiri/
79d91a797af9c6a6ff6d)
demonstrate that the gained with it disk space is not significant
enough to justify empty CPU cycles.
This closes COUCHDB-2726
Robert Newson [Mon, 13 Jul 2015 18:28:08 +0000 (19:28 +0100)]
Track open time without using process dictionary
We were only removing the `{async_open, DbName}` process dictionary entries if
the open is successful. Over time, in busy situations, the process dictionary
can grow very large.
COUCHDB-2749
Paul J. Davis [Mon, 13 Jul 2015 17:14:09 +0000 (12:14 -0500)]
Optimize couch_ejson_compare NIF
The old nif was allocating a set of collators that were reserved and
released by each scheduler thread. This coordination and the
accompanying mutex turned into a global point of contention when many
schedulers were using couch_ejson_compare.
This change removes the stack based concurrency control in favor of a
`__thread variable`. We end up with the same number of collators but
without any overhead around locking a central mutex.
This increases performance by roughly a factor of five.
COUCHDB-2732
Robert Newson [Sun, 12 Jul 2015 13:20:25 +0000 (14:20 +0100)]
Send 400 Bad Request if request body is missing
Robert Newson [Sun, 12 Jul 2015 12:27:12 +0000 (13:27 +0100)]
better error text for check_docids
Robert Newson [Sun, 12 Jul 2015 12:27:26 +0000 (13:27 +0100)]
Revert "Throw bad request for empty POST request body when filtering by doc_ids"
This reverts commit
e858e7dfef06a4d6e6c9228de80628f7166397ef.
Jay Doane [Wed, 8 Jul 2015 22:23:39 +0000 (15:23 -0700)]
Throw bad request for empty POST request body when filtering by doc_ids
JIRA: COUCHDB-2743
BugzID: 48864
Robert Newson [Thu, 2 Jul 2015 21:59:34 +0000 (22:59 +0100)]
erlang R14-18 compatibility
Adam Kocoloski [Tue, 30 Jun 2015 15:37:35 +0000 (11:37 -0400)]
Merge branch '1805-reduce-collation'
COUCHDB-1805
Adam Kocoloski [Mon, 29 Jun 2015 20:24:32 +0000 (16:24 -0400)]
Add a convenience macro for "equal to" test
This macro preserves the expressiveness of ?assertEqual but uses ==
instead of =:=. Useful for situations where the test involves numbers
that may be converted between types (e.g. 1 == 1.0).
Eric Avdey [Wed, 24 Jun 2015 15:36:10 +0000 (12:36 -0300)]
Fix pattern matching order in reduce_sizes
Function `upgrade_sizes` recognises both integer and tuple
data size formats, but pattern matching order in `reduce_sizes`
in `couch_db_updater` do not allow tuple representation
ever reaching it.
Eric Avdey [Wed, 24 Jun 2015 14:52:58 +0000 (11:52 -0300)]
Rename active_size variable for consistency
Eric Avdey [Tue, 26 May 2015 12:59:24 +0000 (09:59 -0300)]
Fix `active_size` format conversion in `get_db_info` function
In `active_size` conversion in `couch_db:get_db_info/1` old db reduction's size format assumed to be an integer representing active state, when it also could be a tuple of active and external sizes.
This handeled correctly, for example, in [couch_db_updater.erl](https://github.com/apache/couchdb-couch/blob/master/src/couch_db_updater.erl#L426).
This patch addresses conversion of both possible formats to CouchDB `size_info` record.
This closes issue COUCHDB-2701
Robert Newson [Tue, 16 Jun 2015 16:17:44 +0000 (17:17 +0100)]
Configurable password scheme
This gives the administrator control over which algorithm is used to
hash passwords and a separate control over whether this happens on
successful authentication or only at password change time.
closes COUCHDB-2725
ILYA Khlopotov [Mon, 15 Jun 2015 12:59:24 +0000 (05:59 -0700)]
Introduce couch_db:normalize_dbname
Move duplicated logic into couch_db:normalize_dbname. We could use this
helper function anywhere we need to extract dbname from shard path.
COUCHDB-2715
Robert Newson [Wed, 3 Jun 2015 18:38:13 +0000 (19:38 +0100)]
Replace password_scheme and iterations field
Previously we introduced duplicates
COUCHDB-2710
Robert Kowalski [Fri, 29 May 2015 13:25:00 +0000 (15:25 +0200)]
perf: http layer - speedup couchdb version lookup
It turned out that we spend a lot of our time for every request in the
function couch_server:get_version which simply gets the current CouchDB
version.
Instead of fetching a list of all loaded applications an filtering it
we are directly getting the current VSN of CouchDB.
Patched version is 10% faster for a simple /get on a document.
(Almost?) All our of request-handlers are accessing this function so it
should be beneficial for large areas of the http layer.
Russell Branca [Thu, 6 Nov 2014 22:53:28 +0000 (14:53 -0800)]
Allow couch_httpd_cors to be disable by the calling process
In chttpd we call into couch_httpd for the low level http functions
like send_json. The function couch_httpd:send_response/4 calls out to
couch_httpd_cors, which will cause duplicate CORS headers to be set
when we've already gone through chttpd_cors.
This is a bit of a hack but it's a good temporary measure until we
consolidate couch_httpd and chttpd down to one http stack.
Robert Newson [Wed, 27 May 2015 18:17:29 +0000 (19:17 +0100)]
Merge remote-tracking branch 'ilya/2689-pass-options-to-test_request'
Robert Newson [Wed, 27 May 2015 18:17:23 +0000 (19:17 +0100)]
Merge remote-tracking branch 'ilya/2688-start-lager-from-test'
Artur Mazurek [Sat, 23 May 2015 14:13:38 +0000 (15:13 +0100)]
Fixing a build for Mac OS 10.10 - missing
mozjs185.
Added /usr/local/lib to linker search path because
couchdb suggests using homebrew to install dependancies and that's
where they are put by default.
COUCHDB-2699
Robert Kowalski [Sun, 1 Mar 2015 14:44:25 +0000 (15:44 +0100)]
add _changes?feed=live sugar for continuous
allow `feed=live` as sugar for `continuous` which is hard to
type. PouchDB already supports `live`.
PRs for the change:
https://github.com/apache/couchdb/pull/307
https://github.com/apache/couchdb-couch/pull/40
https://github.com/apache/couchdb-chttpd/pull/28
closes COUCHDB-2237
Alexander Shorin [Fri, 22 May 2015 17:18:05 +0000 (20:18 +0300)]
Fix global_changes tests
Robert Newson [Tue, 19 May 2015 12:11:28 +0000 (13:11 +0100)]
Revert "use existing salt during sha1->pbkdf2 upgrade to avoid conflicts"
This reverts commit
569338222a9ee38c35d2270b2a2a405be26a0828.
I think I'm wrong about conflicts, we update the document before
we write (in fabric).
Robert Newson [Tue, 19 May 2015 12:05:46 +0000 (13:05 +0100)]
use existing salt during sha1->pbkdf2 upgrade to avoid conflicts
ILYA Khlopotov [Thu, 14 May 2015 16:07:58 +0000 (09:07 -0700)]
Pass Opts to put/post/delete of test_request
We need to pass auth in Opts sometimes.
COUCHDB-2689
ILYA Khlopotov [Thu, 14 May 2015 15:57:42 +0000 (08:57 -0700)]
Include lager into list of extra apps when testing
Starting lager as `lager:start` is an issue since dependencies
started by lager are not included in a list of started applications
so we don't stop them after we are done with current test.
This commit uses test_util:start_applications so all deps of lager are
included into #test_context{}
COUCHDB-2688
ILYA Khlopotov [Wed, 29 Apr 2015 14:20:47 +0000 (07:20 -0700)]
Add test suite for global_changes
COUCHDB-2667
ILYA Khlopotov [Wed, 29 Apr 2015 19:29:03 +0000 (12:29 -0700)]
Fix broken test suite for COUCHDB-2656
COUCHDB-2656
Samuel Tardieu [Tue, 28 Apr 2015 11:17:05 +0000 (13:17 +0200)]
Week of day for past expiration date 1990-01-01 is Monday
Fixes COUCHDB-2677
Alexander Shorin [Thu, 23 Apr 2015 20:42:17 +0000 (23:42 +0300)]
Merge remote-tracking branch 'iilyak/2656-use-chttpd-functions'
This closes #43
COUCHDB-2656
Russell Branca [Tue, 21 Apr 2015 18:10:44 +0000 (18:10 +0000)]
Fix error handling in couch_util:with_proc
Russell Branca [Mon, 20 Apr 2015 19:57:20 +0000 (19:57 +0000)]
add couch_util:with_proc/4
BugzId: 2657
Alexander Shorin [Sat, 18 Apr 2015 13:34:46 +0000 (16:34 +0300)]
Make global_changes database system one
ILYA Khlopotov [Thu, 16 Apr 2015 14:49:30 +0000 (07:49 -0700)]
Add CORS test case for couch_mrview_show
COUCHDB-2656
Alexander Shorin [Sat, 11 Apr 2015 15:51:41 +0000 (18:51 +0300)]
Count HTTP 417 and 501 responses
Alexander Shorin [Sat, 4 Apr 2015 23:33:06 +0000 (02:33 +0300)]
Temporarily add ?assertNotEqual eunit macro for R14*
Alexander Shorin [Sat, 4 Apr 2015 15:06:50 +0000 (18:06 +0300)]
Merge remote-tracking branch 'iilyak/2547-fix-broken-tests'
This closes #35
COUCHDB-2547
Robert Kowalski [Fri, 13 Mar 2015 02:49:49 +0000 (21:49 -0500)]
add license
ILYA Khlopotov [Fri, 6 Mar 2015 22:29:58 +0000 (14:29 -0800)]
Fix race in couch_work_queue_test
COUCHDB-2547
Alexander Shorin [Sun, 1 Mar 2015 19:54:05 +0000 (22:54 +0300)]
Fix compilation warnings
Alexander Shorin [Fri, 27 Feb 2015 14:45:57 +0000 (17:45 +0300)]
Merge remote-tracking branch 'iilyak/2585-allowed_owner-hook'
This closes #37