Merge pull request #895 from yan12125/fix-proxy-auth

Fix retrieving credentials for authenticating against proxies
This commit is contained in:
Sami Vänttinen 2020-06-08 16:18:14 +03:00 committed by GitHub
commit 6a0b2ce60a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,7 +63,11 @@ httpAuth.processPendingCallbacks = async function(details, resolve, reject) {
httpAuth.requests.push(details.requestId);
if (details.challenger) {
details.proxyUrl = details.challenger.host;
// Non-HTTP proxies are possible with PAC scripts, while currently only
// Firefox provides info about the proxy protocol used [1].
// [1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest/onAuthRequired
let scheme = details.proxyInfo ? details.proxyInfo.type : 'http';
details.proxyUrl = scheme + '://' + details.challenger.host;
}
details.searchUrl = (details.isProxy && details.proxyUrl) ? details.proxyUrl : details.url;