glynnbird opened a new pull request, #364:
URL: https://github.com/apache/couchdb-nano/pull/364

   ## Overview
   
   As reported in https://github.com/apache/couchdb-nano/issues/363, when the 
CouchDB URL includes a username & password and those credentials contain 
characters that need to be "percent encoded", then Nano's auth failed. (It did 
work fine for session auth).
   
   After investigation, it turns out that `new URL`, the Node.js URL parser 
returns the `username` and `password` strings _percent encoded_. This meant 
that when these values were base64 encoded to become an `Authorization` header, 
they contained the wrong data (but only for usernames and passwords with 
"special characters"). See https://nodejs.org/api/url.html#urlusername & 
https://nodejs.org/api/url.html#urlpassword.
   
   The solution is simple: just `decodeURIComponent` the values before base64 
encoding them.
   
   ## Testing recommendations
   
   Automated test added.
   
   ## GitHub issue number
   
   https://github.com/apache/couchdb-nano/issues/363,
   
   ## Checklist
   
   - [x] Code is written and works correctly;
   - [x] Changes are covered by tests;
   


-- 
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