couchdb-chttpd.git
22 months agoMerge branch 'couchdb-2992' master
Nick Vatamaniuc [Thu, 16 Mar 2017 02:36:56 +0000 (22:36 -0400)] 
Merge branch 'couchdb-2992'

Closes #157

22 months agoAllow limiting maximum document body size 157/head
Nick Vatamaniuc [Mon, 13 Mar 2017 06:22:19 +0000 (02:22 -0400)] 
Allow limiting maximum document body size

This is the HTTP layer and some tests. The actual checking is done in couch
application's from_json_obj/1 function.

If a document is too large it will return a 413 response code. The error reason
will be the document ID. The intent is to help users identify the document if
they used _bulk_docs endpoint. It will also help replicator skip over documents
which are too large.

COUCHDB-2992

22 months agoMerge remote-tracking branch 'cloudant/64299-add-new-request-parameter'
Nick Vatamaniuc [Wed, 8 Mar 2017 00:13:53 +0000 (19:13 -0500)] 
Merge remote-tracking branch 'cloudant/64299-add-new-request-parameter'

Close #156

22 months agoRename max_document_size to max_http_request_size 156/head
Nick Vatamaniuc [Tue, 7 Mar 2017 23:01:33 +0000 (18:01 -0500)] 
Rename max_document_size to max_http_request_size

`max_document_size` is implemented as `max_http_request_size`. There was no
real check for document size. In some cases the implementation was close enough
of a proxy (PUT-ing and GET-ing single docs), but in some edge cases, like
_bulk_docs requests the discrepancy between request size and document size
could be rather large.

The section was changed accordingly from `couchdb` to `httpd`. `httpd` was
chosen as it applies to both clustered as well as local interface.

There is a parallel effort to implement an actual max_document_size check. The
set of commit should be merged close enough together to allow for a backwards
compatible transition.

COUCHDB-2992

23 months agoMerge remote branch 'cloudant:couchdb-3293'
ILYA Khlopotov [Thu, 9 Feb 2017 21:58:44 +0000 (13:58 -0800)] 
Merge remote branch 'cloudant:couchdb-3293'

This closes #155

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
23 months agoMock config module in tests 155/head
ILYA Khlopotov [Thu, 9 Feb 2017 21:36:39 +0000 (13:36 -0800)] 
Mock config module in tests

The tests in chttpd_db_bulk_get_test do not start config app.
The change in https://github.com/apache/couchdb-couch/pull/226
introduces call to config app.
Make sure we mock config so the tests pass.

COUCHDB-3293

23 months agoIntroduce 503 error when nodes are all unavailable. 154/head
Tony Sun [Wed, 1 Feb 2017 21:23:26 +0000 (13:23 -0800)] 
Introduce 503 error when nodes are all unavailable.

In rare situations when all nodes are down or in maintenance mode and
no workers can service a request, we return a 503 to the user.

COUCHDB-3289

23 months agoHandle error return clauses for fabric:open_revs
Tony Sun [Wed, 1 Feb 2017 21:14:42 +0000 (13:14 -0800)] 
Handle error return clauses for fabric:open_revs

When calling fabric:open_revs, we don't account for situations where
the function returns an {error, any()} value as specified by the
function specification. This will account for errors thrown.

COUCHDB-3289

2 years agoallow w parameter for attachments 153/head
lazedo [Wed, 4 Jan 2017 18:45:31 +0000 (18:45 +0000)] 
allow w parameter for attachments

2 years agoFix missing ampersand in rewritten queries 152/head
Fabian Ising [Thu, 8 Dec 2016 14:58:32 +0000 (15:58 +0100)] 
Fix missing ampersand in rewritten queries

2 years agoMerge default update response headers with custom ones 151/head
Robert Newson [Thu, 1 Dec 2016 15:20:38 +0000 (15:20 +0000)] 
Merge default update response headers with custom ones

This was not ported to chttpd and so wasn't really fixed in 2.0

COUCHDB-1447

2 years agoMerge remote branch 'cloudant:71810-handle-errors-terms-from-fabric'
ILYA Khlopotov [Sat, 12 Nov 2016 00:21:20 +0000 (16:21 -0800)] 
Merge remote branch 'cloudant:71810-handle-errors-terms-from-fabric'

This closes #146

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
2 years agoHandle error terms from fabric 146/head
ILYA Khlopotov [Thu, 13 Oct 2016 22:02:20 +0000 (15:02 -0700)] 
Handle error terms from fabric

The fabric returns errors as {Class, Reason, Stack}
(see fabric_util:error_info/2).
Add the clause to error_info to handle it.

COUCHDB-3195

2 years agoMerge remote branch 'cloudant:78077-pass-user_ctx_to_filter'
Eric Avdey [Fri, 11 Nov 2016 23:13:46 +0000 (19:13 -0400)] 
Merge remote branch 'cloudant:78077-pass-user_ctx_to_filter'

This closes #150

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoInclude user_ctx in db open options 150/head
Eric Avdey [Fri, 11 Nov 2016 14:56:23 +0000 (10:56 -0400)] 
Include user_ctx in db open options

2 years agoAdd ability to return a "features" list in the welcome message. 144/head
Nick Vatamaniuc [Wed, 9 Nov 2016 02:59:30 +0000 (21:59 -0500)] 
Add ability to return a "features" list in the welcome message.

This could help users quickly discover the presence of an API or mode of
operation.

Features are obtained from a new config API `config:features/0`

System components can enable features via `config:enable_feature/1` API, or
users can directly enable features in the .ini files, and those features
should show up in the "Welcome" message.

COUCHDB-3180

2 years agoMerge remote branch 'cloudant:fix-cors-max_age'
Eric Avdey [Fri, 4 Nov 2016 14:36:57 +0000 (11:36 -0300)] 
Merge remote branch 'cloudant:fix-cors-max_age'

This closes #110

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoRemove an unused test's var to avoid a warning 110/head
Eric Avdey [Tue, 22 Mar 2016 18:29:44 +0000 (15:29 -0300)] 
Remove an unused test's var to avoid a warning

2 years agoFix CORS max_age configuration parameter
Eric Avdey [Tue, 22 Mar 2016 18:03:45 +0000 (15:03 -0300)] 
Fix CORS max_age configuration parameter

Header "Access-Control-Max-Age" used by a browser to define
for how long to keep preflight request's response cached.

This fix makes this parameter configurable through config section
[cors], attribute max_age.

2 years agoHTTP code 500 instead of 400 for invalid key during document creation 149/head
Mayya Sharipova [Thu, 3 Nov 2016 23:46:05 +0000 (19:46 -0400)] 
HTTP code 500 instead of 400 for invalid key during document creation

The wrong status code is returned when creating or updating a document
with an invalid key.
Returns:
{u'reason': u'Bad special document member: _invalid_key', u'error':
u'doc_validation'}
HTTPError: 500 Server Error: Internal Server Error
Expected: 400 Bad Request error

COUCHDB-3222

2 years agohandle timeout in _revs_diff 148/head
Mayya Sharipova [Wed, 2 Nov 2016 16:40:48 +0000 (12:40 -0400)] 
handle timeout in _revs_diff

when fabric workers timeout,
fabric:get_missing_revs returns {error,timeout}
this handles timeout errors

COUCHDB-3220

2 years agoreturn a binary so the existing tests pass
Robert Newson [Wed, 19 Oct 2016 11:19:32 +0000 (12:19 +0100)] 
return a binary so the existing tests pass

2 years agoMake auth handlers configurable.
Daniel Münch [Sat, 15 Oct 2016 18:16:53 +0000 (20:16 +0200)] 
Make auth handlers configurable.

2 years agoMerge branch 'couchdb-3174'
Nick Vatamaniuc [Thu, 6 Oct 2016 21:26:39 +0000 (17:26 -0400)] 
Merge branch 'couchdb-3174'

2 years agoPass user context when opening doc in db_attachment_req 145/head
Robert Newson [Wed, 5 Oct 2016 20:57:16 +0000 (21:57 +0100)] 
Pass user context when opening doc in db_attachment_req

COUCHDB-3181

2 years agoMerge remote branch 'cloudant:69425-handle-truncated-req-in-recv_body'
ILYA Khlopotov [Wed, 5 Oct 2016 17:01:49 +0000 (10:01 -0700)] 
Merge remote branch 'cloudant:69425-handle-truncated-req-in-recv_body'

This closes #140

Signed-off-by: ILYA Khlopotov <iilyak@apache.org>
2 years agoHandle disconnect when receiving body 140/head
ILYA Khlopotov [Thu, 22 Sep 2016 23:19:39 +0000 (16:19 -0700)] 
Handle disconnect when receiving body

When any error happen on an underlying socket mochiweb uses
exit(normal). Add catch for exit:normal and convert it to
exit({bad_request, <<"Incomplete">>}).

COUCHDB-3158

2 years agoAdd max_document_size checking for multipart PUT requests 143/head
Nick Vatamaniuc [Tue, 4 Oct 2016 06:58:32 +0000 (02:58 -0400)] 
Add max_document_size checking for multipart PUT requests

Previously multipart/related PUT requests didn't check maximum request sizes.

This commit checks content-length and compares that with the maximum.

This means keeping the current "semantics" of max_document_size which actually
means "max request size". But this makes the check more efficient and can
be done earlier in request processing time.

PR depends on https://github.com/apache/couchdb-couch/pull/201 make sure to
merge that one first if accepted.

Jira: COUCHDB-3174

2 years agoFix eventsource timeout handling 142/head
Robert Newson [Tue, 27 Sep 2016 22:44:54 +0000 (23:44 +0100)] 
Fix eventsource timeout handling

COUCHDB-3164

2 years agoFix SSL defaults 141/head
Robert Newson [Tue, 27 Sep 2016 15:15:44 +0000 (16:15 +0100)] 
Fix SSL defaults

Three properties had their defaults changed to a value that
couch_util:parse_terms throws up on.

"nil" was changed to undefined in COUCHDB-2561 as part of normalising
the config API. The change from list to atom was a mistake.

COUCHDB-3162

2 years agoMerge remote-tracking branch 'will/3090-handle-empty-access-control-request-headers'
Robert Newson [Fri, 23 Sep 2016 11:52:34 +0000 (12:52 +0100)] 
Merge remote-tracking branch 'will/3090-handle-empty-access-control-request-headers'

2 years agoCanonicalise ETag response headers
Robert Newson [Sat, 10 Sep 2016 18:12:34 +0000 (19:12 +0100)] 
Canonicalise ETag response headers

2 years agodon't send random etag for _list (COUCHDB-3134)
Robert Newson [Wed, 7 Sep 2016 13:03:17 +0000 (14:03 +0100)] 
don't send random etag for _list (COUCHDB-3134)

2 years agoEtag's require quotes (COUCHDB-3134)
Robert Newson [Wed, 7 Sep 2016 12:08:29 +0000 (13:08 +0100)] 
Etag's require quotes (COUCHDB-3134)

2 years agoMerge branch '2.0-suppress-user-not-found-warning' of https://github.com/wohali/couch...
Joan Touzet [Fri, 2 Sep 2016 10:29:02 +0000 (06:29 -0400)] 
Merge branch '2.0-suppress-user-not-found-warning' of https://github.com/wohali/couchdb-chttpd

2 years agoMerge remote-tracking branch 'will/3017-ETag-not-unique'
Robert Newson [Fri, 2 Sep 2016 10:25:09 +0000 (11:25 +0100)] 
Merge remote-tracking branch 'will/3017-ETag-not-unique'

2 years agoDrop logging level for "no record of user %s" 139/head
Joan Touzet [Fri, 2 Sep 2016 03:58:37 +0000 (23:58 -0400)] 
Drop logging level for "no record of user %s"

This warning is tripped primarily when an admin is defined in local.ini
and has no associated _users document. This can happen fairly often in
development and testing setups, meaning that every other line in the
logfile is "no record of user admin".

The right thing to do here might be to check if the currently defined
user is a local admin and only complain in that situation, but presently
chttpd only directly depends on couch_auth_cache and to do so would
require unencapsulating how couch_auth_cache handles ini file defined
admin users vs. authentication database users, which feels wrong.

Change suggested by @janl in #couchdb-dev IRC.

2 years agofix compilation warning
Robert Newson [Thu, 1 Sep 2016 10:53:00 +0000 (11:53 +0100)] 
fix compilation warning

2 years agoMerge remote branch 'cloudant:3102-fix-config_subscription'
ILYA Khlopotov [Tue, 23 Aug 2016 21:59:31 +0000 (14:59 -0700)] 
Merge remote branch 'cloudant:3102-fix-config_subscription'

This closes #137

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoUpdate handle_config_terminate API 137/head
ILYA Khlopotov [Wed, 17 Aug 2016 18:37:54 +0000 (11:37 -0700)] 
Update handle_config_terminate API

COUCHDB-3102

2 years agoMerge remote-tracking branch 'cloudant/2779-view-cleanup-cluster-aware'
Robert Newson [Thu, 11 Aug 2016 11:28:05 +0000 (12:28 +0100)] 
Merge remote-tracking branch 'cloudant/2779-view-cleanup-cluster-aware'

2 years agoImplement clustered _compact endpoint 136/head
Robert Newson [Thu, 11 Aug 2016 09:52:24 +0000 (10:52 +0100)] 
Implement clustered _compact endpoint

COUCHDB-3099

2 years agoHandle empty "Access-Control-Request-Headers" header 135/head
Will Holley [Mon, 1 Aug 2016 16:57:44 +0000 (17:57 +0100)] 
Handle empty "Access-Control-Request-Headers" header

When "Access-Control-Request-Headers" is empty, return an empty
"Access-Control-Allow-Headers" in the response. This is the same
behaviour as when the "Access-Control-Request-Headers" header is
omitted from the request entirely.

Fixes COUCHDB-3090

2 years agoDon't set "authenticated" if party_mode_handler sets user context 134/head
Robert Newson [Wed, 27 Jul 2016 18:24:12 +0000 (19:24 +0100)] 
Don't set "authenticated" if party_mode_handler sets user context

Patch suggested by Ilya.

COUCHDB-3084

2 years agoFormat the changes listener exit Reason
Paul J. Davis [Mon, 25 Jul 2016 17:28:50 +0000 (12:28 -0500)] 
Format the changes listener exit Reason

2 years agoIn a multi-query view request, set view type for each query
Nick Vatamaniuc [Thu, 21 Jul 2016 21:48:15 +0000 (17:48 -0400)] 
In a multi-query view request, set view type for each query

Namely, a default `reduce` view type can be overridden to behave like a `map`,
if user explicitly sets `reduce=false`.

Previously this didn't happen. For example, a query like this:

```
{
  "queries": [{
    "include_docs": true,
    "reduce": false
  }]
}
```

 would fail with:

```
{"error":"query_parse_error","reason":"`include_docs` is invalid for reduce"}
```

 but it shouldn't, because user explicitly disabled `reduce` and now
`include_docs` is valid for a map view.

To fix, make sure to call `set_view_type` for each query's args.

Jira: COUCHDB-3070

2 years agoUpdate logging for new couch_log
Paul J. Davis [Fri, 22 Jul 2016 10:14:56 +0000 (05:14 -0500)] 
Update logging for new couch_log

The nonce is now included in all log messages when its set. The order of
host and client are also swapped to make more sense.

2 years agoTolerate failure of ensure_auth_ddoc_exists call 132/head
Robert Newson [Tue, 12 Jul 2016 12:23:05 +0000 (13:23 +0100)] 
Tolerate failure of ensure_auth_ddoc_exists call

ensure_auth_ddoc_exists can crash if _users db does not exist, so move
it to the spawned listen_for_changes process where we already tolerate
the possibility of a crash (and have logic to restart after 5 seconds)

COUCHDB-3054

2 years agoDon't end changes feed listener on heartbeat 131/head
Robert Newson [Tue, 12 Jul 2016 09:21:24 +0000 (10:21 +0100)] 
Don't end changes feed listener on heartbeat

There's no need to end and restart the changes feed listener on every
heartbeat, so don't do that.

COUCHDB-3054

2 years agoMerge remote branch 'cloudant:3000-inject_auth_ddoc'
ILYA Khlopotov [Mon, 11 Jul 2016 14:55:03 +0000 (07:55 -0700)] 
Merge remote branch 'cloudant:3000-inject_auth_ddoc'

This closes #115

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoInject _design/_auth on auth_cache startup 115/head
ILYA Khlopotov [Wed, 20 Apr 2016 15:45:42 +0000 (08:45 -0700)] 
Inject _design/_auth on auth_cache startup

We send start_listener event from init to make sure we call
ensure_auth_ddoc_exists as soon as we can. Rather then calling it on
listener restart.

COUCHDB-3000

2 years agoHandle ssl socket case 130/head
Jay Doane [Thu, 7 Jul 2016 15:40:23 +0000 (08:40 -0700)] 
Handle ssl socket case

COUCHDB-3049

2 years agoRevert broken fix attempt for ssl sockname
Jay Doane [Thu, 7 Jul 2016 15:37:14 +0000 (08:37 -0700)] 
Revert broken fix attempt for ssl sockname

2 years agoMerge remote branch 'cloudant:69230-fix-epi_handle_error_args'
ILYA Khlopotov [Thu, 30 Jun 2016 18:00:36 +0000 (11:00 -0700)] 
Merge remote branch 'cloudant:69230-fix-epi_handle_error_args'

This closes #129

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoDo not pass unknown_error atom to plugin 129/head
ILYA Khlopotov [Thu, 30 Jun 2016 17:03:12 +0000 (10:03 -0700)] 
Do not pass unknown_error atom to plugin

There is no reason to pass {unknown_error, Error} to plugin and force it to
implement a match on that tuple. We should pass the Error itself and let
the plugin decide what to do with it.

2 years agoCall appropriate sockname function for socket type 128/head
Jay Doane [Tue, 28 Jun 2016 19:39:19 +0000 (12:39 -0700)] 
Call appropriate sockname function for socket type

COUCHDB: 3049

2 years agoPass user context in couch_doc_open
Robert Newson [Thu, 16 Jun 2016 22:24:05 +0000 (23:24 +0100)] 
Pass user context in couch_doc_open

Fixes bug where a user can't update or delete their own _users doc.

COUCHDB-2991

2 years agoMerge remote branch 'cloudant:67171-dont-decode-params-in-multiview'
Eric Avdey [Mon, 13 Jun 2016 19:25:59 +0000 (16:25 -0300)] 
Merge remote branch 'cloudant:67171-dont-decode-params-in-multiview'

This closes #127

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoDon't try to decode params in multi_query_view 127/head
Eric Avdey [Mon, 13 Jun 2016 16:53:55 +0000 (13:53 -0300)] 
Don't try to decode params in multi_query_view

2 years agoMerge remote branch 'cloudant:67171-fix-multi_query_view-response'
Eric Avdey [Mon, 13 Jun 2016 15:04:43 +0000 (12:04 -0300)] 
Merge remote branch 'cloudant:67171-fix-multi_query_view-response'

This closes #125

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoDon't expect #vacc as a response in multi_query_view 125/head
Eric Avdey [Tue, 7 Jun 2016 17:32:39 +0000 (14:32 -0300)] 
Don't expect #vacc as a response in multi_query_view

When multi_query_view is calling chttpd:end_delayed_json_response/1 it is
passing in the response object it received from query_view's #vacc,
which means it'll get back resp record and not #vacc.

2 years agoMerge remote branch 'github/pr/123'
Eric Avdey [Thu, 2 Jun 2016 19:24:30 +0000 (16:24 -0300)] 
Merge remote branch 'github/pr/123'

This closes #123

Signed-off-by: Eric Avdey <eiri@eiri.ca>
2 years agoFix _node/$node/_system endpoint 123/head
Eric Avdey [Fri, 27 May 2016 17:59:23 +0000 (14:59 -0300)] 
Fix _node/$node/_system endpoint

The endpoint is using same handler as a backdoor interface,
which only works for the requests to a local $node.
For rpc calls to the remote nodes, the same as it's done
on rest of /_node endpoints, handle_node_req handler is getting
{badrpc,{'EXIT',normal}} response and fails with invalid_ejson exception.

The change splits stats gathering from stats responding,
allowing to use former on both /_node/$node/_system
and backend's /_system endpoints.

2 years agoMerge remote branch 'cloudant:2730-fix-compilation-warnings'
ILYA Khlopotov [Thu, 2 Jun 2016 17:52:11 +0000 (10:52 -0700)] 
Merge remote branch 'cloudant:2730-fix-compilation-warnings'

This closes #124

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoFix compilation warnings 124/head
ILYA Khlopotov [Thu, 2 Jun 2016 17:38:16 +0000 (10:38 -0700)] 
Fix compilation warnings

COUCHDB-2730

2 years agorestore 1.x _users and _replicator behaviour
Jan Lehnardt [Mon, 16 May 2016 11:01:04 +0000 (13:01 +0200)] 
restore 1.x _users and _replicator behaviour

COUCHDB-2991

2 years agofix in logic that denies login with conflicted user docs 122/head
Jan Lehnardt [Mon, 16 May 2016 12:13:46 +0000 (14:13 +0200)] 
fix in logic that denies login with conflicted user docs

2 years agofix missing transition in cassim revert, sec obj in external calls empty
Jan Lehnardt [Sun, 15 May 2016 19:38:04 +0000 (21:38 +0200)] 
fix missing transition in cassim revert, sec obj in external calls empty

2 years agouse shard suffix when generating _changes ETag 120/head
Will Holley [Fri, 13 May 2016 21:15:32 +0000 (22:15 +0100)] 
use shard suffix when generating _changes ETag

In CouchDB 2.0, instance_start_time is always 0.
This means that when generating ETag values derived
from the database info object, the same ETags can be
incorrectly deemed valid between different database
instances with the metadata.

To avoid this we can incorporate the unique shard
suffix for the database instance when generating
the current ETag value.

COUCHDB-3017

2 years agodisable cassim until fixed 119/head
Jan Lehnardt [Fri, 13 May 2016 10:55:38 +0000 (12:55 +0200)] 
disable cassim until fixed

2 years agosupport admin party after d2665ce support-admin-party-after-d2665ce 117/head
Jan Lehnardt [Mon, 25 Apr 2016 20:19:52 +0000 (22:19 +0200)] 
support admin party after d2665ce

2 years agoMerge branch 'fix-users-doc-in-conflict'
Jan Lehnardt [Mon, 25 Apr 2016 19:25:41 +0000 (21:25 +0200)] 
Merge branch 'fix-users-doc-in-conflict'

* fix-users-doc-in-conflict:
  restore 1.x behaviour: user docs in conflict cannot login

2 years agorestore 1.x behaviour: user docs in conflict cannot login
Jan Lehnardt [Mon, 25 Apr 2016 19:24:58 +0000 (21:24 +0200)] 
restore 1.x behaviour: user docs in conflict cannot login

Adds config option chttpd_auth/allow_conflicted_user_docs to toggle
this behaviour. The default is to not allow conflicted user docs to
log in successfully.

2 years agorestore 1.x behaviour: user docs in conflict cannot login 116/head
Jan Lehnardt [Sat, 23 Apr 2016 23:28:32 +0000 (01:28 +0200)] 
restore 1.x behaviour: user docs in conflict cannot login

Adds config option chttpd_auth/allow_conflicted_user_docs to toggle
this behaviour. The default is to not allow conflicted user docs to
log in successfully.

2 years agoMerge remote branch 'github/pr/109'
ILYA Khlopotov [Fri, 15 Apr 2016 18:32:30 +0000 (11:32 -0700)] 
Merge remote branch 'github/pr/109'

This closes #109

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoAdd `log_format_test` test case 109/head
ILYA Khlopotov [Mon, 21 Mar 2016 20:06:28 +0000 (13:06 -0700)] 
Add `log_format_test` test case

COUCHDB-2973

2 years agoLog user name of request initiator
ILYA Khlopotov [Mon, 21 Mar 2016 19:23:31 +0000 (12:23 -0700)] 
Log user name of request initiator

Change the log format from chttpd to include username.
The new format is (space separated):

Nonce, Peer, Host, UserName, Method, RawUri, Code, Status, RequestTime

COUCHDB-2973

2 years agoReject incorrectly encoded urls 113/head
Eric Avdey [Tue, 12 Apr 2016 18:39:29 +0000 (15:39 -0300)] 
Reject incorrectly encoded urls

COUCHDB-2748

2 years agotolerate failure when inserting auth ddoc 112/head
Robert Newson [Tue, 12 Apr 2016 15:39:44 +0000 (16:39 +0100)] 
tolerate failure when inserting auth ddoc

COUCHDB-2986

2 years agoCreate md5 etag for _local docs local-docs-2978 111/head
Garren Smith [Thu, 7 Apr 2016 13:47:05 +0000 (15:47 +0200)] 
Create md5 etag for _local docs

This makes a unique ETAG for _local docs, so that they are cached
correctly, and fetched again when the document changes.

fixes COUCHDB-2978

2 years agoMerge remote branch 'github/pr/108'
ILYA Khlopotov [Tue, 22 Mar 2016 12:33:56 +0000 (05:33 -0700)] 
Merge remote branch 'github/pr/108'

This closes #108

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoUse couch_tests:setup/1 108/head
ILYA Khlopotov [Thu, 17 Mar 2016 17:59:01 +0000 (10:59 -0700)] 
Use couch_tests:setup/1

2 years agoUse couch_tests applications for chttpd_plugin_tests
ILYA Khlopotov [Thu, 17 Mar 2016 17:36:53 +0000 (10:36 -0700)] 
Use couch_tests applications for chttpd_plugin_tests

2 years agoMerge remote branch 'github/pr/106'
ILYA Khlopotov [Tue, 15 Mar 2016 17:44:42 +0000 (10:44 -0700)] 
Merge remote branch 'github/pr/106'

This closes #106

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoAdd test suite for chttpd_plugin 106/head
ILYA Khlopotov [Tue, 8 Mar 2016 20:30:00 +0000 (12:30 -0800)] 
Add test suite for chttpd_plugin

COUCHDB-2966

2 years agoAdd chttpd_plugin:before_serve_file/5 EPI hook
ILYA Khlopotov [Tue, 8 Mar 2016 18:46:17 +0000 (10:46 -0800)] 
Add chttpd_plugin:before_serve_file/5 EPI hook

COUCHDB-2966

2 years agoIntroduce chttpd_plugin:before_response/4 EPI hook
ILYA Khlopotov [Tue, 8 Mar 2016 18:24:49 +0000 (10:24 -0800)] 
Introduce chttpd_plugin:before_response/4 EPI hook

COUCHDB-2966

2 years agoExtract handle_response function
ILYA Khlopotov [Tue, 8 Mar 2016 16:57:55 +0000 (08:57 -0800)] 
Extract handle_response function

COUCHDB-2966

2 years agoExtract basic_headers/2 function
ILYA Khlopotov [Tue, 8 Mar 2016 16:32:24 +0000 (08:32 -0800)] 
Extract basic_headers/2 function

COUCHDB-2966

2 years agoCache favicon for one year 104/head
Alexander Shorin [Sun, 6 Mar 2016 14:15:15 +0000 (17:15 +0300)] 
Cache favicon for one year

2 years agoBackport CSP fix from couchdb-couch
Robert Kowalski [Thu, 3 Sep 2015 14:10:20 +0000 (16:10 +0200)] 
Backport CSP fix from couchdb-couch

Needed for the ace editor icons
See https://github.com/apache/couchdb-couch/pull/2

This closes #68

2 years agoEliminate unnecessary apply 107/head
Jay Doane [Mon, 14 Mar 2016 03:51:05 +0000 (20:51 -0700)] 
Eliminate unnecessary apply

2 years agoMerge remote branch 'github/pr/105'
ILYA Khlopotov [Tue, 8 Mar 2016 18:32:32 +0000 (10:32 -0800)] 
Merge remote branch 'github/pr/105'

This closes #105

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoFix dispatch to handle_error EPI hook 105/head
ILYA Khlopotov [Tue, 8 Mar 2016 17:59:38 +0000 (09:59 -0800)] 
Fix dispatch to handle_error EPI hook

2 years ago Merge remote branch 'github/pr/101'
ILYA Khlopotov [Thu, 3 Mar 2016 20:01:54 +0000 (12:01 -0800)] 
Merge remote branch 'github/pr/101'

    This closes #101

Signed-off-by: ILYA Khlopotov <iilyak@ca.ibm.com>
2 years agoSuppress log of a response for clustered interface 101/head
ILYA Khlopotov [Thu, 3 Mar 2016 16:07:38 +0000 (08:07 -0800)] 
Suppress log of a response for clustered interface

COUCHDB-2945

2 years agoTreat value passed in Origin as case sensitive
ILYA Khlopotov [Tue, 9 Feb 2016 22:41:22 +0000 (14:41 -0800)] 
Treat value passed in Origin as case sensitive

According to CORS spec here https://www.w3.org/TR/cors
The value of the Origin header is not a case-sensitive

COUCHDB-2945

2 years agoStrip scheme out of Host for cors_section
ILYA Khlopotov [Tue, 16 Feb 2016 23:23:37 +0000 (15:23 -0800)] 
Strip scheme out of Host for cors_section

Value returned by `couch_httpd_vhost:host/1` might not contain scheme.
The cors section is named after vhost name (i.e. without scheme).
For example:

    [cors:partner.com]
    methods =
    headers =
    exposed_headers =
    origins = http://restricted.dev:8000

The origin in origins has to be given with scheme included.

COUCHDB-2945

2 years agoIntroduce vhosts configuration into CORS
ILYA Khlopotov [Tue, 9 Feb 2016 21:22:05 +0000 (13:22 -0800)] 
Introduce vhosts configuration into CORS

In order to remove code duplication we move vhosts support
from couch_http_cors into chttpd_cors. We also dispatch
chttpd:send_response to couch_http which does call chttpd_cors:headers.
In order to avoid double injection of CORS headers we check for existance of
"Access-Control-Allow-Origin" in response headers.

COUCHDB-2945

2 years agoMerge remote-tracking branch 'github/pr/100'
Alexander Shorin [Tue, 2 Feb 2016 15:23:06 +0000 (18:23 +0300)] 
Merge remote-tracking branch 'github/pr/100'