nickva opened a new pull request, #6188:
URL: https://github.com/apache/couchdb/pull/6188

   Stop redirecting to ourselves, instead just handle the request.
   
   This also fixes a regression introduced in #6187
   
   ```sh
   
   set -eu
   
   DB=http://127.0.0.1:15984
   
   curl -sS -u adm:pass -o /dev/null -XDELETE "$DB/db" || true
   curl -sS -u adm:pass -o /dev/null -XPUT "$DB/db?q=1"
   curl -sS -u adm:pass -o /dev/null -XPUT "$DB/db/_design/ddoc" -H 
'Content-Type: application/json' -d '{"views":{"v":{"map":"function(doc){ if 
(doc.x) emit(doc.x, 1); }"}}}'
   curl -sS -u adm:pass -o /dev/null -XPUT "$DB/db/a" -H 'Content-Type: 
application/json' -d '{"x":"a"}'
   echo "*********** see the redirects"
   curl -sS -u adm:pass -g -i 
"$DB/db/_design%2Fddoc/_view/v?startkey=[\"a\"]&endkey=[\"z\"]"
   echo "*********** follow redirects"
   curl -L -sS -u adm:pass -g -i
   "$DB/db/_design%2Fddoc/_view/v?startkey=[\"a\"]&endkey=[\"z\"]"
   ```
   
   With the fix:
   ```
   ./redir.sh
   *********** see the redirects
   HTTP/1.1 200 OK
   
   {"total_rows":1,"offset":1,"rows":[
   
   ]}
   
   *********** follow redirects
   HTTP/1.1 200 OK
   {"total_rows":1,"offset":1,"rows":[
   
   ]}
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to