[GitHub] couchdb-couch issue #226: Allow limiting length of document ID

2017-02-06 Thread nickva
Github user nickva commented on the issue:

https://github.com/apache/couchdb-couch/pull/226
  
Before setting the limit (python code):

```
d1 = {"_id":"2"*21}
d.update([d1])

>>>  [(True, u'2', 
u'1-967a00dff5e02add41819138abb3284d')]
```

after `> config:set("couchdb", "max_document_id_length", "20").`

```
d2 = {"_id":"x"*21}
d.update([d2])

ServerError: (400, (u'illegal_docid', u'Document id is too long'))
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (COUCHDB-3293) Configure maximum document ID length

2017-02-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15855344#comment-15855344
 ] 

ASF GitHub Bot commented on COUCHDB-3293:
-

GitHub user nickva opened a pull request:

https://github.com/apache/couchdb-couch/pull/226

Allow limiting length of document ID

Previously it was not possibly to define a maxum document ID size. That 
meant
large document ID would hit various limitations and corner cases. For 
example,
large document IDs could be inserted via a _bulk_docs endpoint but then 
trying
to insert the same document via a single HTTP method like PUT would fail
because of a limitation in Mochiweb's HTTP parser.

Let operators specify a maxium document ID length via the:

```
couchdb.max_document_id_length = 0
```

configuration.

The default value of 0 means current behavior where document ID length is 
not
checked.

COUCHDB-3293

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cloudant/couchdb-couch couchdb-3293

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-couch/pull/226.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #226


commit 8e1443a8165d07311ab1c0b1a5c0a33fb48de08b
Author: Nick Vatamaniuc 
Date:   2017-02-07T04:53:51Z

Allow limiting length of document ID

Previously it was not possibly to define a maxum document ID size. That 
meant
large document ID would hit various limitations and corner cases. For 
example,
large document IDs could be inserted via a _bulk_docs endpoint but then 
trying
to insert the same document via a single HTTP method like PUT would fail
because of a limitation in Mochiweb's HTTP parser.

Let operators specify a maxium document ID length via the:

```
couchdb.max_document_id_length = 0
```

configuration.

The default value of 0 means current behavior where document ID length is 
not
checked.

COUCHDB-3293




> Configure maximum document ID length
> 
>
> Key: COUCHDB-3293
> URL: https://issues.apache.org/jira/browse/COUCHDB-3293
> Project: CouchDB
>  Issue Type: New Feature
>Reporter: Nick Vatamaniuc
>
> Allow users / operators to specify maximum document ID length.
> Currently it is easy to break CouchDB by feeding it large IDs through 
> _bulk_docs endpoint but which will hit the limits of http parser if sent 
> through GET/PUT/DELETE methods. In case those limits are hit the error 
> returned is not obvious as the requests would often crash in the mochiweb 
> http parser step before a request even makes to CouchDB code.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] couchdb-couch pull request #226: Allow limiting length of document ID

2017-02-06 Thread nickva
GitHub user nickva opened a pull request:

https://github.com/apache/couchdb-couch/pull/226

Allow limiting length of document ID

Previously it was not possibly to define a maxum document ID size. That 
meant
large document ID would hit various limitations and corner cases. For 
example,
large document IDs could be inserted via a _bulk_docs endpoint but then 
trying
to insert the same document via a single HTTP method like PUT would fail
because of a limitation in Mochiweb's HTTP parser.

Let operators specify a maxium document ID length via the:

```
couchdb.max_document_id_length = 0
```

configuration.

The default value of 0 means current behavior where document ID length is 
not
checked.

COUCHDB-3293

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/cloudant/couchdb-couch couchdb-3293

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-couch/pull/226.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #226


commit 8e1443a8165d07311ab1c0b1a5c0a33fb48de08b
Author: Nick Vatamaniuc 
Date:   2017-02-07T04:53:51Z

Allow limiting length of document ID

Previously it was not possibly to define a maxum document ID size. That 
meant
large document ID would hit various limitations and corner cases. For 
example,
large document IDs could be inserted via a _bulk_docs endpoint but then 
trying
to insert the same document via a single HTTP method like PUT would fail
because of a limitation in Mochiweb's HTTP parser.

Let operators specify a maxium document ID length via the:

```
couchdb.max_document_id_length = 0
```

configuration.

The default value of 0 means current behavior where document ID length is 
not
checked.

COUCHDB-3293




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Commented] (COUCHDB-2709) Replicating through https apache reverse proxy causes timeout error

2017-02-06 Thread Ian Goodacre (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-2709?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15855295#comment-15855295
 ] 

Ian Goodacre commented on COUCHDB-2709:
---

I am having the same issue, using Apache httpd 2.4 as reverse proxy.

> Replicating through https apache reverse proxy causes timeout error
> ---
>
> Key: COUCHDB-2709
> URL: https://issues.apache.org/jira/browse/COUCHDB-2709
> Project: CouchDB
>  Issue Type: Bug
>Affects Versions: 1.6.1
>Reporter: Tim Rutherford
> Attachments: httpd.conf, httpd-ssl.conf
>
>
> Replicating from a remote couchdb database behind a apache reverse proxy over 
> an https connection fails. 
> Simply changing the connection to use http instead of https allows the 
> replication to work. Also, changing the couch configuration to use https 
> (port 6984) and replicating from that directly also seems to work. So it 
> seems to be a combination of https and a reverse proxy at the same time that 
> is causing the issue.
> When analyzing the network traffic with wireshark I can see several requests 
> being made from couchdb. The first few requests to the database seem to be 
> fine. The request for a specific document looks to be fine in wireshark, but 
> is reported as timeout error in couchdbs log. The response looks to be a 
> valid http 200 response with the correct data in wireshark.
> Futon shows replication as triggered. The status page shows the replication 
> as stuck at 0% and the checkpoint never advances.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Created] (COUCHDB-3293) Configure maximum document ID length

2017-02-06 Thread Nick Vatamaniuc (JIRA)
Nick Vatamaniuc created COUCHDB-3293:


 Summary: Configure maximum document ID length
 Key: COUCHDB-3293
 URL: https://issues.apache.org/jira/browse/COUCHDB-3293
 Project: CouchDB
  Issue Type: New Feature
Reporter: Nick Vatamaniuc


Allow users / operators to specify maximum document ID length.

Currently it is easy to break CouchDB by feeding it large IDs through 
_bulk_docs endpoint but which will hit the limits of http parser if sent 
through GET/PUT/DELETE methods. In case those limits are hit the error returned 
is not obvious as the requests would often crash in the mochiweb http parser 
step before a request even makes to CouchDB code.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (COUCHDB-3291) Excessively long document IDs prevent replicator from making progress

2017-02-06 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15855085#comment-15855085
 ] 

ASF subversion and git services commented on COUCHDB-3291:
--

Commit 8ca9106fe84c938fcfff161635fd16cf39956b95 in couchdb's branch 
refs/heads/master from [~vatamane]
[ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=8ca9106 ]

Bump replicator dependency

COUCHDB-3291


> Excessively long document IDs prevent replicator from making progress
> -
>
> Key: COUCHDB-3291
> URL: https://issues.apache.org/jira/browse/COUCHDB-3291
> Project: CouchDB
>  Issue Type: Bug
>Reporter: Nick Vatamaniuc
>
> Currently there is not protection in couchdb from creating IDs which are too 
> long. So large IDs will hit various implicit limits which usually results in 
> unpredictable failure modes.
> On such example implicit limit is hit in the replicator code. Replicate 
> usually fetches document IDs in a bulk-like call either gets them via changes 
> feed, computes revs_diffs in a post or inserts them with bulk_docs, except 
> one case when it fetch open_revs. There it uses a single GET request. That 
> requests fails because there is a bug / limitation in the http parser. The 
> first GET line in the http request has to fit in the receive buffer for the 
> receiving socket. 
> Increasing that buffer allow passing through larger http requests lines. In 
> configuration options it can be manipulated as 
> {code}
>  chttpd.server_options="[...,{recbuf, 32768},...]"
> {code}
> Steve Vinoski mentions something about a possible bug in http packet parser 
> code as well:
> http://erlang.org/pipermail/erlang-questions/2011-June/059567.html
> Tracing this a bit I see that a proper mochiweb request is never even created 
> and instead request hangs. So that confirms it further. It seems in the code 
> here:
> https://github.com/apache/couchdb-mochiweb/blob/bd6ae7cbb371666a1f68115056f7b30d13765782/src/mochiweb_http.erl#L90
> The timeout clause is hit. Adding a catchall exception I get the 
> {tcp_error,#Port<0.40682>,emsgsize} message which we don't handle. Seems like 
> a sane place to throw a 413 or such there.
> There are probably multiple ways to address the issue:
>  * Increase mochiweb listener buffer to fit larger doc ids. However that is a 
> separate bug and using it to control document size during replication is not 
> reliable. Moreover that would allow larger IDs to propagate through the 
> system during replication, then would have to configure all future 
> replication source with the same maximum recbuf value.
>  * Introduce a validation step in {code} couch_doc:validate_docid {code}. 
> Currently that code doesn't read from config files and is in the hotpath. 
> Added a config read in there might reduce performance.  If that is enabled it 
> would stop creating new documents with large ids. But have to decide how to 
> handle already existing IDs which are larger than the limit.
>  * Introduce a validation/bypass in the replicator. Specifically targeting 
> replicator might help prevent propagation of large IDs during replication. 
> There is a already a similar case of skipping writing large attachment or 
> large documents (which exceed request size) and bumping {code} 
> doc_write_failures {code}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (COUCHDB-3291) Excessively long document IDs prevent replicator from making progress

2017-02-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15855063#comment-15855063
 ] 

ASF GitHub Bot commented on COUCHDB-3291:
-

Github user asfgit closed the pull request at:

https://github.com/apache/couchdb-couch-replicator/pull/54


> Excessively long document IDs prevent replicator from making progress
> -
>
> Key: COUCHDB-3291
> URL: https://issues.apache.org/jira/browse/COUCHDB-3291
> Project: CouchDB
>  Issue Type: Bug
>Reporter: Nick Vatamaniuc
>
> Currently there is not protection in couchdb from creating IDs which are too 
> long. So large IDs will hit various implicit limits which usually results in 
> unpredictable failure modes.
> On such example implicit limit is hit in the replicator code. Replicate 
> usually fetches document IDs in a bulk-like call either gets them via changes 
> feed, computes revs_diffs in a post or inserts them with bulk_docs, except 
> one case when it fetch open_revs. There it uses a single GET request. That 
> requests fails because there is a bug / limitation in the http parser. The 
> first GET line in the http request has to fit in the receive buffer for the 
> receiving socket. 
> Increasing that buffer allow passing through larger http requests lines. In 
> configuration options it can be manipulated as 
> {code}
>  chttpd.server_options="[...,{recbuf, 32768},...]"
> {code}
> Steve Vinoski mentions something about a possible bug in http packet parser 
> code as well:
> http://erlang.org/pipermail/erlang-questions/2011-June/059567.html
> Tracing this a bit I see that a proper mochiweb request is never even created 
> and instead request hangs. So that confirms it further. It seems in the code 
> here:
> https://github.com/apache/couchdb-mochiweb/blob/bd6ae7cbb371666a1f68115056f7b30d13765782/src/mochiweb_http.erl#L90
> The timeout clause is hit. Adding a catchall exception I get the 
> {tcp_error,#Port<0.40682>,emsgsize} message which we don't handle. Seems like 
> a sane place to throw a 413 or such there.
> There are probably multiple ways to address the issue:
>  * Increase mochiweb listener buffer to fit larger doc ids. However that is a 
> separate bug and using it to control document size during replication is not 
> reliable. Moreover that would allow larger IDs to propagate through the 
> system during replication, then would have to configure all future 
> replication source with the same maximum recbuf value.
>  * Introduce a validation step in {code} couch_doc:validate_docid {code}. 
> Currently that code doesn't read from config files and is in the hotpath. 
> Added a config read in there might reduce performance.  If that is enabled it 
> would stop creating new documents with large ids. But have to decide how to 
> handle already existing IDs which are larger than the limit.
>  * Introduce a validation/bypass in the replicator. Specifically targeting 
> replicator might help prevent propagation of large IDs during replication. 
> There is a already a similar case of skipping writing large attachment or 
> large documents (which exceed request size) and bumping {code} 
> doc_write_failures {code}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] couchdb-couch-replicator pull request #54: Allow configuring maximum documen...

2017-02-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/couchdb-couch-replicator/pull/54


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch-replicator issue #54: Allow configuring maximum document ID le...

2017-02-06 Thread nickva
Github user nickva commented on the issue:

https://github.com/apache/couchdb-couch-replicator/pull/54
  
Thanks @iilyak !


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fabric issue #86: Return Error When Workers Crash

2017-02-06 Thread nickva
Github user nickva commented on the issue:

https://github.com/apache/couchdb-fabric/pull/86
  
@tonysun83 Yap it will still end up retrying in open_revs. It is not ideal 
but for now we can keep it like that


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch-replicator issue #54: Allow configuring maximum document ID le...

2017-02-06 Thread iilyak
Github user iilyak commented on the issue:

https://github.com/apache/couchdb-couch-replicator/pull/54
  
The master has been updated. Rebasing. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-couch-replicator issue #54: Allow configuring maximum document ID le...

2017-02-06 Thread iilyak
Github user iilyak commented on the issue:

https://github.com/apache/couchdb-couch-replicator/pull/54
  
Nick is away today. However he asked me to help merging it. I am going to 
merge it on his behalf.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-chttpd pull request #154: Add Error Clause For fabric:open_revs call...

2017-02-06 Thread iilyak
Github user iilyak commented on a diff in the pull request:

https://github.com/apache/couchdb-chttpd/pull/154#discussion_r99672964
  
--- Diff: test/chttpd_open_revs_error_test.erl ---
@@ -0,0 +1,107 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may 
not
+% use this file except in compliance with the License. You may obtain a 
copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations 
under
+% the License.
+
+-module(chttpd_open_revs_error_test).
+
+-include_lib("couch/include/couch_eunit.hrl").
+-include_lib("couch/include/couch_db.hrl").
+
+-define(USER, "chttpd_db_test_admin").
+-define(PASS, "pass").
+-define(AUTH, {basic_auth, {?USER, ?PASS}}).
+-define(CONTENT_JSON, {"Content-Type", "application/json"}).
+-define(CONTENT_MULTI_FORM, {"Content-Type",
+"multipart/form-data;boundary=\"bound\""}).
+
+setup() ->
+ok = config:set("admins", ?USER, ?PASS, _Persist=false),
+TmpDb = ?tempdb(),
+Addr = config:get("chttpd", "bind_address", "127.0.0.1"),
+Port = mochiweb_socket_server:get(chttpd, port),
+Url = lists:concat(["http://;, Addr, ":", Port, "/", ?b2l(TmpDb)]),
+create_db(Url),
+Url.
+
+teardown(Url) ->
+delete_db(Url),
--- End diff --

Please add `(catch meck:unload(fabric)),` here. Alternatively you can 
revise the setup/teardown logic. Currently you do mocking from inside of a test 
case. You could use foreachx and pass `post_form | simple_put` parameter so you 
can do the right things in setup/1. In this case mocking would be in setup/1 
and unmocking in teardown/2.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-chttpd pull request #154: Add Error Clause For fabric:open_revs call...

2017-02-06 Thread iilyak
Github user iilyak commented on a diff in the pull request:

https://github.com/apache/couchdb-chttpd/pull/154#discussion_r99671057
  
--- Diff: test/chttpd_open_revs_error_test.erl ---
@@ -0,0 +1,107 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may 
not
+% use this file except in compliance with the License. You may obtain a 
copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations 
under
+% the License.
+
+-module(chttpd_open_revs_error_test).
+
+-include_lib("couch/include/couch_eunit.hrl").
+-include_lib("couch/include/couch_db.hrl").
+
+-define(USER, "chttpd_db_test_admin").
+-define(PASS, "pass").
+-define(AUTH, {basic_auth, {?USER, ?PASS}}).
+-define(CONTENT_JSON, {"Content-Type", "application/json"}).
+-define(CONTENT_MULTI_FORM, {"Content-Type",
+"multipart/form-data;boundary=\"bound\""}).
+
+setup() ->
+ok = config:set("admins", ?USER, ?PASS, _Persist=false),
+TmpDb = ?tempdb(),
+Addr = config:get("chttpd", "bind_address", "127.0.0.1"),
+Port = mochiweb_socket_server:get(chttpd, port),
+Url = lists:concat(["http://;, Addr, ":", Port, "/", ?b2l(TmpDb)]),
+create_db(Url),
+Url.
+
+teardown(Url) ->
+delete_db(Url),
+ok = config:delete("admins", ?USER, _Persist=false).
+
+create_db(Url) ->
+{ok, Status, _, _} = test_request:put(Url, [?CONTENT_JSON, ?AUTH], 
"{}"),
+?assert(Status =:= 201 orelse Status =:= 202).
+
+
+create_doc(Url, Id) ->
+test_request:put(Url ++ "/" ++ Id,
+[?CONTENT_JSON, ?AUTH], "{\"mr\": \"rockoartischocko\"}").
+
+delete_db(Url) ->
+{ok, 200, _, _} = test_request:delete(Url, [?AUTH]).
+
+open_revs_error_test_() ->
+{
+"open revs error tests",
+{
+setup,
+fun chttpd_test_util:start_couch/0, fun 
chttpd_test_util:stop_couch/1,
+{
+foreach,
+fun setup/0, fun teardown/1,
+[
+fun should_return_503_error_for_open_revs_get/1,
+fun should_return_503_error_for_open_revs_post_form/1
+]
+}
+}
+}.
+
+should_return_503_error_for_open_revs_get(Url) ->
+{ok, _, _, Body} = create_doc(Url, "testdoc"),
+{Json} = ?JSON_DECODE(Body),
+Ref = couch_util:get_value(<<"rev">>, Json, undefined),
+mock(fabric),
+mock_open_revs({error, all_workers_died}),
+ok, Code, _, _} = test_request:get(Url ++
+"/testdoc?rev=" ++ ?b2l(Ref), [?AUTH]),
+ meck:unload(fabric),
+ ?_assertEqual(503, Code).
+
+should_return_503_error_for_open_revs_post_form(Url) ->
+Port = mochiweb_socket_server:get(chttpd, port),
+Host = lists:concat([ "http://127.0.0.1:;, Port]),
+Referer = {"Referer", Host},
+Body1 = "{\"body\":\"This is a body.\"}",
+DocBeg = "--bound\r\nContent-Disposition: form-data; 
name=\"_doc\"\r\n\r\n",
+DocRev = "--bound\r\nContent-Disposition: form-data; 
name=\"_rev\"\r\n\r\n",
+DocRest = lists:concat(["\r\n--bound\r\nContent-Disposition:",
--- End diff --

You could write this as:
```
DocRest = "\r\n--bound\r\nContent-Disposition:"
"form-data; name=\"_attachments\"; filename=\"file.txt\"\r\n"
"Content-Type: text/plain\r\n\r\ncontents of file.txt\r\n\r\n"
"--bound--",
```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-chttpd pull request #154: Add Error Clause For fabric:open_revs call...

2017-02-06 Thread iilyak
Github user iilyak commented on a diff in the pull request:

https://github.com/apache/couchdb-chttpd/pull/154#discussion_r99669106
  
--- Diff: test/chttpd_open_revs_error_test.erl ---
@@ -0,0 +1,107 @@
+% Licensed under the Apache License, Version 2.0 (the "License"); you may 
not
+% use this file except in compliance with the License. You may obtain a 
copy of
+% the License at
+%
+%   http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+% License for the specific language governing permissions and limitations 
under
+% the License.
+
+-module(chttpd_open_revs_error_test).
+
+-include_lib("couch/include/couch_eunit.hrl").
+-include_lib("couch/include/couch_db.hrl").
+
+-define(USER, "chttpd_db_test_admin").
+-define(PASS, "pass").
+-define(AUTH, {basic_auth, {?USER, ?PASS}}).
+-define(CONTENT_JSON, {"Content-Type", "application/json"}).
+-define(CONTENT_MULTI_FORM, {"Content-Type",
+"multipart/form-data;boundary=\"bound\""}).
+
+setup() ->
+ok = config:set("admins", ?USER, ?PASS, _Persist=false),
+TmpDb = ?tempdb(),
+Addr = config:get("chttpd", "bind_address", "127.0.0.1"),
+Port = mochiweb_socket_server:get(chttpd, port),
+Url = lists:concat(["http://;, Addr, ":", Port, "/", ?b2l(TmpDb)]),
+create_db(Url),
+Url.
+
+teardown(Url) ->
+delete_db(Url),
+ok = config:delete("admins", ?USER, _Persist=false).
+
+create_db(Url) ->
+{ok, Status, _, _} = test_request:put(Url, [?CONTENT_JSON, ?AUTH], 
"{}"),
+?assert(Status =:= 201 orelse Status =:= 202).
+
+
+create_doc(Url, Id) ->
+test_request:put(Url ++ "/" ++ Id,
+[?CONTENT_JSON, ?AUTH], "{\"mr\": \"rockoartischocko\"}").
+
+delete_db(Url) ->
+{ok, 200, _, _} = test_request:delete(Url, [?AUTH]).
+
+open_revs_error_test_() ->
+{
+"open revs error tests",
+{
+setup,
+fun chttpd_test_util:start_couch/0, fun 
chttpd_test_util:stop_couch/1,
+{
+foreach,
+fun setup/0, fun teardown/1,
+[
+fun should_return_503_error_for_open_revs_get/1,
+fun should_return_503_error_for_open_revs_post_form/1
+]
+}
+}
+}.
+
+should_return_503_error_for_open_revs_get(Url) ->
+{ok, _, _, Body} = create_doc(Url, "testdoc"),
+{Json} = ?JSON_DECODE(Body),
+Ref = couch_util:get_value(<<"rev">>, Json, undefined),
+mock(fabric),
+mock_open_revs({error, all_workers_died}),
+ok, Code, _, _} = test_request:get(Url ++
--- End diff --

@tonysun83: There is a syntax error here (missing `{`)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fauxton pull request #844: Make db names more random

2017-02-06 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/couchdb-fauxton/pull/844


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Resolved] (COUCHDB-3229) Fauxton does not URL encode DB names in navigation links

2017-02-06 Thread Garren Smith (JIRA)

 [ 
https://issues.apache.org/jira/browse/COUCHDB-3229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Garren Smith resolved COUCHDB-3229.
---
Resolution: Fixed
  Assignee: Garren Smith

THis 
(commit)[https://github.com/apache/couchdb-fauxton/commit/a88bad950c325a8d0a5b06470e0b26b050d11d8a]
 should fix the final issues

> Fauxton does not URL encode DB names in navigation links
> 
>
> Key: COUCHDB-3229
> URL: https://issues.apache.org/jira/browse/COUCHDB-3229
> Project: CouchDB
>  Issue Type: Bug
>  Components: Fauxton
>Affects Versions: 2.0.0
>Reporter: Garth Gutenberg
>Assignee: Garren Smith
>
> Steps to reproduce:
> 1. Create a database called {{my/test}}
> 1. Navigate to this DB in Fauxton
> 1. Note that all links for DB actions (inner sidebar) are *not* URL encoded. 
> Click the All Documents link and it navigates you to 
> {{/_utils/#/database/my/test/_all_docs}} (which isn't a valid route, so 
> nothing happens) instead of {{/_utils/#/database/my%2Ftest/_all_docs}}.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] couchdb-fauxton pull request #844: Make db names more random

2017-02-06 Thread garrensmith
GitHub user garrensmith opened a pull request:

https://github.com/apache/couchdb-fauxton/pull/844

Make db names more random



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/garrensmith/couchdb-fauxton 
improve-encoding-test

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/couchdb-fauxton/pull/844.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #844


commit df033399ecd06d098f340aa793fdf5be799ef915
Author: Garren Smith 
Date:   2017-02-06T15:10:18Z

Make db names more random




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[jira] [Created] (COUCHDB-3292) option to not return key/value results on all_docs or view

2017-02-06 Thread Mike McKay (JIRA)
Mike McKay created COUCHDB-3292:
---

 Summary: option to not return key/value results on all_docs or view
 Key: COUCHDB-3292
 URL: https://issues.apache.org/jira/browse/COUCHDB-3292
 Project: CouchDB
  Issue Type: New Feature
  Components: HTTP Interface
Reporter: Mike McKay


In order to keep the amount of data transferred to a minimum I would like an 
option to remove key/value results when doing an all_docs or view query. For 
instance, if I want to create a link to each document found by a query, and I 
use all_docs to list them, I get a lot of redundant data:

{"total_rows":1319,"offset":119,"rows":[
{"id":"image_TUSOMETEACHER_2017-01-01_BARINGO_AKORET","key":"image_TUSOMETEACHER_2017-01-01_BARINGO_AKORET","value":{"rev":"11-b5baef58a2594dc9b2773efcbc49ed98"}}


For an all_docs query, the id and key will always be the same. Also, I don't 
need the value (rev information) at all. It would be nice to be able to remove 
this from the results, and thereby significantly reduce the amount of data sent 
back.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[jira] [Commented] (COUCHDB-3224) Fauxton not correctly display database with "-" and "/" symbol in name

2017-02-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/COUCHDB-3224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15853961#comment-15853961
 ] 

ASF GitHub Bot commented on COUCHDB-3224:
-

Github user garrensmith commented on the issue:

https://github.com/apache/couchdb-fauxton/pull/802
  
@sergey-safarov thanks for trying to help us with this. We have decided to 
rather solve this with `encodeURIComponent`. I've just merged a PR that should 
fix the view section. 

Unfortunately we won't need this PR. But it would be great if you could 
test fauxton master and make sure we have now fixed all the encoding issues.


> Fauxton not correctly display database with "-" and "/" symbol in name
> --
>
> Key: COUCHDB-3224
> URL: https://issues.apache.org/jira/browse/COUCHDB-3224
> Project: CouchDB
>  Issue Type: Bug
>  Components: Fauxton
>Reporter: Sergey Safarov
>
> Fauxton cannot display database with "-" symbol in name and cannot display 
> view with "/" simbol in database name.
> Tu reproduce execute "curl -X PUT 
> http://127.0.0.1:5984/mytest%2Fdata%2Fbase-201609; ant try open this database 
> via fauxton.
> Also if you create view for this database then this view wont work.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


[GitHub] couchdb-fauxton issue #802: COUCHDB-3224: Fixed view displaying for database...

2017-02-06 Thread garrensmith
Github user garrensmith commented on the issue:

https://github.com/apache/couchdb-fauxton/pull/802
  
@sergey-safarov thanks for trying to help us with this. We have decided to 
rather solve this with `encodeURIComponent`. I've just merged a PR that should 
fix the view section. 

Unfortunately we won't need this PR. But it would be great if you could 
test fauxton master and make sure we have now fixed all the encoding issues.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fauxton pull request #843: fix encoding in views

2017-02-06 Thread garrensmith
Github user garrensmith closed the pull request at:

https://github.com/apache/couchdb-fauxton/pull/843


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fauxton issue #843: fix encoding in views

2017-02-06 Thread garrensmith
Github user garrensmith commented on the issue:

https://github.com/apache/couchdb-fauxton/pull/843
  
Merged


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-chttpd issue #147: Make auth handlers configurable.

2017-02-06 Thread ChiragMoradiya
Github user ChiragMoradiya commented on the issue:

https://github.com/apache/couchdb-chttpd/pull/147
  
May I know, when this will be released?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] couchdb-fauxton issue #843: fix encoding in views

2017-02-06 Thread robertkowalski
Github user robertkowalski commented on the issue:

https://github.com/apache/couchdb-fauxton/pull/843
  
+1


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---