Skip to content

Commit f17ea01

Browse files
committed
Do not use Tor Browser proxy settings directly, let TB handle network connections
1 parent b0b932f commit f17ea01

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

src/components/ssl-observatory.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,16 @@ SSLObservatory.prototype = {
778778
*/
779779
this.proxy_test_successful = null;
780780

781-
if (this.getProxySettings().tor_safe == false) {
781+
var proxy_settings = this.getProxySettings();
782+
// if proxy_settings is false, we're using tor browser for sure
783+
// if tor_safe is false, the user has specified use_custom_proxy
784+
// in either case, don't issue request to tor check url
785+
if (!proxy_settings) {
786+
this.proxy_test_successful = true;
787+
this.log(INFO, "Tor check assumed succeeded.");
788+
return;
789+
}
790+
if (proxy_settings.tor_safe == false) {
782791
this.proxy_test_successful = false;
783792
this.log(INFO, "Tor check failed: Not safe to check.");
784793
return;
@@ -851,18 +860,7 @@ SSLObservatory.prototype = {
851860
this.log(INFO,"in getProxySettings()");
852861
var custom_proxy_type = this.myGetCharPref("proxy_type");
853862
if (this.torbutton_installed && this.myGetBoolPref("use_tor_proxy")) {
854-
this.log(INFO,"CASE: use_tor_proxy");
855-
// extract tor browser proxy settings
856-
proxy_settings.type = "http";
857-
proxy_settings.host = this.prefs.getCharPref("network.proxy.http");
858-
proxy_settings.port = this.prefs.getIntPref("network.proxy.http_port");
859-
860-
if (proxy_settings.port == 0) {
861-
proxy_settings.type = "socks";
862-
proxy_settings.host = this.prefs.getCharPref("network.proxy.socks");
863-
proxy_settings.port = this.prefs.getIntPref("network.proxy.socks_port");
864-
}
865-
proxy_settings.tor_safe = true;
863+
return false;
866864
/* Regarding the test below:
867865
*
868866
* custom_proxy_type == "direct" is indicative of the user having selected "submit certs even if
@@ -916,12 +914,16 @@ SSLObservatory.prototype = {
916914
// for the torbutton proxy settings.
917915
try {
918916
proxy_settings = this.getProxySettings(testingForTor);
919-
proxy = this.pps.newProxyInfo(
920-
proxy_settings.type,
921-
proxy_settings.host,
922-
proxy_settings.port,
923-
Ci.nsIProxyInfo.TRANSPARENT_PROXY_RESOLVES_HOST,
924-
0xFFFFFFFF, null);
917+
if(proxy_settings){
918+
proxy = this.pps.newProxyInfo(
919+
proxy_settings.type,
920+
proxy_settings.host,
921+
proxy_settings.port,
922+
Ci.nsIProxyInfo.TRANSPARENT_PROXY_RESOLVES_HOST,
923+
0xFFFFFFFF, null);
924+
} else {
925+
proxy = aProxy;
926+
}
925927
} catch(e) {
926928
this.log(WARN, "Error specifying proxy for observatory: "+e);
927929
}

0 commit comments

Comments
 (0)