sindresorhus / got

🌐 Human-friendly and powerful HTTP request library for Node.js
MIT License
14.27k stars 935 forks source link

decodeURIComponent basic auth #1249

Closed stevenvachon closed 4 years ago

stevenvachon commented 4 years ago

Describe the bug

Similar to #1234, basic auth values are not decoded before sending to http.request, resulting in authentication failure.

Code to reproduce

These send "%3Duser" and "%3Dpass" to http.request:

const url = new URL('http://host');
url.username = '=user';
url.password = '=pass';
got(new URL(url));
got({
  password: '=user',
  url: 'http://host',
  username: '=user'
});
const url = new URL('http://host');
got(`${url.protocol}//=user:=pass@${url.host}`);

Checklist

szmarczak commented 4 years ago

Duplicate of #1169