def req_config_handler(self): req = urlparse.urlparse(self.path).query reqs = urlparse.parse_qs(req, keep_blank_values=True) data = '' try: if reqs['cmd'] == ['get_config']: data = json.dumps(user_config.user_special, default=lambda o: o.__dict__) elif reqs['cmd'] == ['set_config']: user_config.user_special.appid = self.postvars['appid'][0] user_config.user_special.password = self.postvars['password'][ 0] user_config.user_special.proxy_enable = self.postvars[ 'proxy_enable'][0] user_config.user_special.proxy_type = self.postvars[ 'proxy_type'][0] user_config.user_special.proxy_host = self.postvars[ 'proxy_host'][0] user_config.user_special.proxy_port = self.postvars[ 'proxy_port'][0] user_config.user_special.proxy_user = self.postvars[ 'proxy_user'][0] user_config.user_special.proxy_passwd = self.postvars[ 'proxy_passwd'][0] user_config.user_special.host_appengine_mode = self.postvars[ 'host_appengine_mode'][0] user_config.user_special.ip_connect_interval = int( self.postvars['ip_connect_interval'][0]) user_config.user_special.use_ipv6 = int( self.postvars['use_ipv6'][0]) user_config.user_special.connect_interval = int( self.postvars['connect_interval'][0]) user_config.save() config.load() appid_manager.reset_appid() import connect_manager connect_manager.load_sock() connect_manager.https_manager.load_config() connect_manager.forwork_manager.load_config() google_ip.load_config() check_ip.load_sock() data = '{"res":"success"}' self.send_response('text/html', data) #http_request("http://127.0.0.1:8085/init_module?module=gae_proxy&cmd=restart") return except Exception as e: xlog.exception("req_config_handler except:%s", e) data = '{"res":"fail", "except":"%s"}' % e self.send_response('text/html', data)
def req_config_handler(self): req = urlparse.urlparse(self.path).query reqs = urlparse.parse_qs(req, keep_blank_values=True) data = '' try: if reqs['cmd'] == ['get_config']: data = json.dumps(user_config.user_special, default=lambda o: o.__dict__) elif reqs['cmd'] == ['set_config']: user_config.user_special.appid = self.postvars['appid'][0] user_config.user_special.password = self.postvars['password'][0] user_config.user_special.proxy_enable = self.postvars['proxy_enable'][0] user_config.user_special.proxy_type = self.postvars['proxy_type'][0] user_config.user_special.proxy_host = self.postvars['proxy_host'][0] user_config.user_special.proxy_port = self.postvars['proxy_port'][0] user_config.user_special.proxy_user = self.postvars['proxy_user'][0] user_config.user_special.proxy_passwd = self.postvars['proxy_passwd'][0] user_config.user_special.host_appengine_mode = self.postvars['host_appengine_mode'][0] user_config.user_special.ip_connect_interval = int(self.postvars['ip_connect_interval'][0]) user_config.user_special.use_ipv6 = int(self.postvars['use_ipv6'][0]) user_config.user_special.connect_interval = int(self.postvars['connect_interval'][0]) user_config.save() config.load() appid_manager.reset_appid() import connect_manager connect_manager.load_sock() connect_manager.https_manager.load_config() connect_manager.forwork_manager.load_config() google_ip.load_config() check_ip.load_sock() data = '{"res":"success"}' self.send_response('text/html', data) #http_request("http://127.0.0.1:8085/init_module?module=gae_proxy&cmd=restart") return except Exception as e: xlog.exception("req_config_handler except:%s", e) data = '{"res":"fail", "except":"%s"}' % e self.send_response('text/html', data)