Fix retrieving credentials for authenticating against proxies

KeePassXC uses QUrl for matching URLs against entries [1], so
standard-compliant URLs are needed.

[1] 9d2e066aca/src/browser/BrowserService.cpp (L356)
This commit is contained in:
Chih-Hsuan Yen 2020-05-21 22:09:56 +08:00
parent 1ef4543f95
commit f098c5813f
No known key found for this signature in database
GPG key ID: F98EF2A7B0A098AE

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;