diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index fefbea1ff9..92fb00241b 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -511,7 +511,7 @@ Zotero.HTTP = new function() { if (xmlhttp.status == 0) { try { - this.checkSecurity(channel); + this.checkSecurity(channel, { isProxyAuthRequest: options.isProxyAuthRequest }); } catch (e) { deferred.reject(e); @@ -1011,14 +1011,15 @@ Zotero.HTTP = new function() { Zotero.debug("Proxy required for " + uri + " -- making HEAD request to trigger auth prompt"); yield Zotero.HTTP.request("HEAD", uri, { foreground: true, - noCache: true + noCache: true, + isProxyAuthRequest: true }) .catch(function (e) { + Zotero.logError("Error connecting to proxy -- proxied requests may not work"); + Zotero.logError(e); + // Show error icon at startup - if (!e.dialogHeader) { - e.dialogHeader = Zotero.getString('networkError.errorViaProxy'); - } - e.message += "\n\n" + Zotero.getString('startupError.internetFunctionalityMayNotWork'); + e.dialogHeader = Zotero.getString('networkError.errorViaProxy'); if (!e.dialogButtonText) { e.dialogButtonText = Zotero.getString('general.moreInformation'); e.dialogButtonCallback = () => { @@ -1026,9 +1027,6 @@ Zotero.HTTP = new function() { }; } Zotero.proxyFailure = e; - Zotero.logError(e); - let msg = "Error connecting to proxy -- proxied requests may not work"; - Zotero.logError(msg); }); break; } @@ -1417,7 +1415,7 @@ Zotero.HTTP = new function() { } - this.checkSecurity = function (channel) { + this.checkSecurity = function (channel, { isProxyAuthRequest } = {}) { if (!channel) { return; } @@ -1433,6 +1431,15 @@ Zotero.HTTP = new function() { // Show actual error from the networking stack, with the hyperlink around the // error code removed msg = Zotero.Utilities.unescapeHTML(secInfo.errorMessage); + if (msg.includes('.' + ZOTERO_CONFIG.DOMAIN_NAME + ' ') + || msg.includes(ZOTERO_CONFIG.PROXY_AUTH_URL.match(/^https:\/\/([^\/]+)\//)[1] + ' ')) { + msg = Zotero.getString('networkError.connectionMonitored', Zotero.appName) + + "\n\n" + + (isProxyAuthRequest + ? Zotero.getString('startupError.internetFunctionalityMayNotWork') + "\n\n" + : "") + + Zotero.getString('general.error') + ": " + msg.split(/\n/)[0]; + } dialogButtonText = Zotero.getString('general.moreInformation'); dialogButtonCallback = function () { Zotero.launchURL('https://www.zotero.org/support/kb/ssl_certificate_error'); diff --git a/chrome/locale/en-US/zotero/zotero.properties b/chrome/locale/en-US/zotero/zotero.properties index b0f9cae3f8..df4025e3db 100644 --- a/chrome/locale/en-US/zotero/zotero.properties +++ b/chrome/locale/en-US/zotero/zotero.properties @@ -106,6 +106,7 @@ general.operationInProgress.waitUntilFinishedAndTryAgain = Please wait until it networkError.connectionNotSecure = %S could not make a secure connection. networkError.errorViaProxy = Error connecting via proxy server +networkError.connectionMonitored = Your connection is likely being monitored, and %S has not been configured to trust the intermediate server. about.createdBy = %1$S is a project of %2$S and is developed by a [global community]. about.openSource = %S is [open-source software] and depends on many [exceptional open-source projects].