From a0bc4e45026c24d5bd50ef6a4ca975afc2b1dfbb Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 3 Jul 2021 20:11:46 +0200 Subject: [PATCH] do not perform ssl_check when successive_success=0 aestetics --- proxywatchd.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/proxywatchd.py b/proxywatchd.py index c99a2cb..8e8ecc3 100644 --- a/proxywatchd.py +++ b/proxywatchd.py @@ -71,12 +71,12 @@ class WorkerJob(): if checktype == 'irc': srvname = random.choice(config.servers).strip() use_ssl = random.choice([0,1]) if config.watchd.use_ssl == 2 else config.watchd.use_ssl - if (self.consecutive_success % 3) == 0: use_ssl = 1 + if self.consecutive_success > 0 and (self.consecutive_success % 3) == 0: use_ssl = 1 server_port = 6697 if use_ssl else 6667 elif checktype == 'http': srvname = random.choice( ['www.facebook.com', 'www.reddit.com', 'www.twitter.com'] ) use_ssl = random.choice([0,1]) if config.watchd.use_ssl == 2 else config.watchd.use_ssl - if (self.consecutive_success % 3) == 0: use_ssl = 1 + if self.consecutive_success > 0 and (self.consecutive_success % 3) == 0: use_ssl = 1 server_port = 443 if use_ssl else 80 protos = ['http', 'socks5', 'socks4'] if self.proto is None else [self.proto] @@ -106,7 +106,7 @@ class WorkerJob(): sock.send('NICK\n') elif checktype == 'http': sock.send('HEAD / HTTP/1.0\r\nHost: %s\r\n\r\n' % srvname) - return sock, proto, duration, torhost, srvname, 0 + return sock, proto, duration, torhost, srvname, 0, use_ssl except rocksock.RocksockException as e: if config.watchd.debug: _log("proxy failed: %s://%s: %s"%(proto, self.proxy, e.get_errormessage()), 'debug') @@ -142,13 +142,13 @@ class WorkerJob(): except KeyboardInterrupt as e: raise(e) - return None, None, None, None, None, fail_inc + return None, None, None, None, None, fail_inc, use_ssl def run(self): self.checktime = int(time.time()) checktype = config.watchd.checktype - sock, proto, duration, tor, srv, failinc = self.connect_socket(checktype) + sock, proto, duration, tor, srv, failinc, is_ssl = self.connect_socket(checktype) if not sock: self.failcount += failinc return @@ -174,7 +174,7 @@ class WorkerJob(): self.total_duration += int(duration*1000) torstats = "" if len(config.torhosts)==1 else ' tor: %s;'%tor recvstats = "".join([x if x in string.printable and ord(x) > 32 else '.' for x in recv]) - _log('%s://%s (%s) d: %.2f sec(s);%s srv: %s; recv: %s' % (proto, self.proxy, self.country, duration, torstats, srv, recvstats), 'xxxxx') + _log('%s://%s (%s) d: %.2f sec(s);%s srv: %s; ssl: %s; recv: %s' % (proto, self.proxy, self.country, duration, torstats, srv, str(is_ssl), recvstats[:50]), 'xxxxx') else: self.failcount += 1 self.consecutive_success = 0