-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JS-rewritten post/put hangs or returns bad_request #1612
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behavior
JS rewrite, returning
{path:'whatever', method:'PUT', body:'body'}
should send body to the rewritten endpoint.Current Behavior
The
body
field of rewrite fn returned obj is in some cases dropped. If source request was POST/PUT, the rewritten requests hangs, or, if source request was GET-like,bad_request
error is sent as response.Steps to Reproduce
zz
rewrites
into the bucket. Below ddoc is intended to create new random doc on each request to_design/n/_rewrite
endpoint:http:https://couchdb_ip/zz/_design/n/_rewrite
.Solution
The issue is caused by cleaning-up rewritten request prematurely here:
https://github.com/apache/couchdb/blob/master/src/chttpd/src/chttpd_rewrite.erl#L67.
It should only be cleaned if we have no body to send.
That line (L67) should be replaced with this code:
It seems to fix issue completely.
Your Environment
The text was updated successfully, but these errors were encountered: