move proxy fallback away from send method
This commit is contained in:
@@ -190,14 +190,7 @@ class HttpStratumInterface(PollingInterface):
|
|||||||
import urllib2, json, time, cookielib
|
import urllib2, json, time, cookielib
|
||||||
|
|
||||||
if self.proxy:
|
if self.proxy:
|
||||||
# This is a friendly fallback to the old style default proxy options
|
|
||||||
if(self.proxy["mode"] == "none"):
|
|
||||||
simple_config = SimpleConfig()
|
|
||||||
simple_config.set_key("proxy", None, True)
|
|
||||||
return
|
|
||||||
|
|
||||||
import socks
|
import socks
|
||||||
|
|
||||||
socks.setdefaultproxy(proxy_modes.index(self.proxy["mode"]), self.proxy["host"], int(self.proxy["port"]) )
|
socks.setdefaultproxy(proxy_modes.index(self.proxy["mode"]), self.proxy["host"], int(self.proxy["port"]) )
|
||||||
socks.wrapmodule(urllib2)
|
socks.wrapmodule(urllib2)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from util import user_dir
|
|||||||
|
|
||||||
class SimpleConfig:
|
class SimpleConfig:
|
||||||
|
|
||||||
|
|
||||||
default_options = {
|
default_options = {
|
||||||
"gui": "lite",
|
"gui": "lite",
|
||||||
"proxy": None,
|
"proxy": None,
|
||||||
@@ -26,6 +25,10 @@ class SimpleConfig:
|
|||||||
os.mkdir(self.config_folder)
|
os.mkdir(self.config_folder)
|
||||||
self.save_config()
|
self.save_config()
|
||||||
|
|
||||||
|
# This is a friendly fallback to the old style default proxy options
|
||||||
|
if(self.config.get("proxy") is not None and self.config["proxy"]["mode"] == "none"):
|
||||||
|
self.set_key("proxy", None, True)
|
||||||
|
|
||||||
def set_key(self, key, value, save = True):
|
def set_key(self, key, value, save = True):
|
||||||
self.config[key] = value
|
self.config[key] = value
|
||||||
if save == True:
|
if save == True:
|
||||||
|
|||||||
Reference in New Issue
Block a user