@@ -830,21 +830,27 @@ SSLObservatory.prototype = {
830830 getProxySettings : function ( testingForTor ) {
831831 // This may be called either for an Observatory submission, or during a test to see if Tor is
832832 // present. The testingForTor argument is true in the latter case.
833- var proxy_settings = [ "direct" , "" , 0 ] ;
833+ var proxy_settings = {
834+ type : "direct" ,
835+ host : "" ,
836+ port : 0 ,
837+ tor_safe : false
838+ } ;
834839 this . log ( INFO , "in getProxySettings()" ) ;
835840 var custom_proxy_type = this . myGetCharPref ( "proxy_type" ) ;
836841 if ( this . torbutton_installed && this . myGetBoolPref ( "use_tor_proxy" ) ) {
837842 this . log ( INFO , "CASE: use_tor_proxy" ) ;
838843 // extract torbutton proxy settings
839- proxy_settings [ 0 ] = "http" ;
840- proxy_settings [ 1 ] = this . prefs . getCharPref ( "extensions.torbutton.https_proxy" ) ;
841- proxy_settings [ 2 ] = this . prefs . getIntPref ( "extensions.torbutton.https_port" ) ;
842-
843- if ( proxy_settings [ 2 ] == 0 ) {
844- proxy_settings [ 0 ] = "socks" ;
845- proxy_settings [ 1 ] = this . prefs . getCharPref ( "extensions.torbutton.socks_host" ) ;
846- proxy_settings [ 2 ] = this . prefs . getIntPref ( "extensions.torbutton.socks_port" ) ;
844+ proxy_settings . type = "http" ;
845+ proxy_settings . host = this . prefs . getCharPref ( "extensions.torbutton.https_proxy" ) ;
846+ proxy_settings . port = this . prefs . getIntPref ( "extensions.torbutton.https_port" ) ;
847+
848+ if ( proxy_settings . port == 0 ) {
849+ proxy_settings . type = "socks" ;
850+ proxy_settings . host = this . prefs . getCharPref ( "extensions.torbutton.socks_host" ) ;
851+ proxy_settings . port = this . prefs . getIntPref ( "extensions.torbutton.socks_port" ) ;
847852 }
853+ proxy_settings . tor_safe = true ;
848854 /* Regarding the test below:
849855 *
850856 * custom_proxy_type == "direct" is indicative of the user having selected "submit certs even if
@@ -855,15 +861,17 @@ SSLObservatory.prototype = {
855861 */
856862 } else if ( this . myGetBoolPref ( "use_custom_proxy" ) && ! ( testingForTor && custom_proxy_type == "direct" ) ) {
857863 this . log ( INFO , "CASE: use_custom_proxy" ) ;
858- proxy_settings [ 0 ] = custom_proxy_type ;
859- proxy_settings [ 1 ] = this . prefs . getCharPref ( "extensions.https_everywhere._observatory.proxy_host" ) ;
860- proxy_settings [ 2 ] = this . prefs . getIntPref ( "extensions.https_everywhere._observatory.proxy_port" ) ;
864+ proxy_settings . type = custom_proxy_type ;
865+ proxy_settings . host = this . myGetCharPref ( "proxy_host" ) ;
866+ proxy_settings . port = this . prefs . getIntPref ( "extensions.https_everywhere._observatory.proxy_port" ) ;
867+ proxy_settings . tor_safe = false ;
861868 } else {
862869 /* Take a guess at default tor proxy settings */
863870 this . log ( INFO , "CASE: try localhost:9050" ) ;
864- proxy_settings [ 0 ] = "socks" ;
865- proxy_settings [ 1 ] = "localhost" ;
866- proxy_settings [ 2 ] = 9050 ;
871+ proxy_settings . type = "socks" ;
872+ proxy_settings . host = "localhost" ;
873+ proxy_settings . port = 9050 ;
874+ proxy_settings . tor_safe = true ;
867875 }
868876 this . log ( INFO , "Using proxy: " + proxy_settings ) ;
869877 return proxy_settings ;
@@ -896,10 +904,12 @@ SSLObservatory.prototype = {
896904 // for the torbutton proxy settings.
897905 try {
898906 proxy_settings = this . getProxySettings ( testingForTor ) ;
899- proxy = this . pps . newProxyInfo ( proxy_settings [ 0 ] , proxy_settings [ 1 ] ,
900- proxy_settings [ 2 ] ,
901- Ci . nsIProxyInfo . TRANSPARENT_PROXY_RESOLVES_HOST ,
902- 0xFFFFFFFF , null ) ;
907+ proxy = this . pps . newProxyInfo (
908+ proxy_settings . type ,
909+ proxy_settings . host ,
910+ proxy_settings . port ,
911+ Ci . nsIProxyInfo . TRANSPARENT_PROXY_RESOLVES_HOST ,
912+ 0xFFFFFFFF , null ) ;
903913 } catch ( e ) {
904914 this . log ( WARN , "Error specifying proxy for observatory: " + e ) ;
905915 }
0 commit comments