http flake8 fixes
This commit is contained in:
parent
68e09a5e30
commit
7eced454d1
|
@ -2,11 +2,13 @@ import socket
|
||||||
|
|
||||||
from advanceddispatcher import AdvancedDispatcher
|
from advanceddispatcher import AdvancedDispatcher
|
||||||
import asyncore_pollchoose as asyncore
|
import asyncore_pollchoose as asyncore
|
||||||
from proxy import Proxy, ProxyError, GeneralProxyError
|
from proxy import ProxyError
|
||||||
from socks5 import Socks5Connection, Socks5Resolver, Socks5AuthError, Socks5Error
|
from socks5 import Socks5Connection, Socks5Resolver
|
||||||
from socks4a import Socks4aConnection, Socks4aResolver, Socks4aError
|
from socks4a import Socks4aConnection, Socks4aResolver
|
||||||
|
|
||||||
class HttpError(ProxyError): pass
|
|
||||||
|
class HttpError(ProxyError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class HttpConnection(AdvancedDispatcher):
|
class HttpConnection(AdvancedDispatcher):
|
||||||
|
@ -19,8 +21,10 @@ class HttpConnection(AdvancedDispatcher):
|
||||||
print "connecting in background to %s:%i" % (self.destination[0], self.destination[1])
|
print "connecting in background to %s:%i" % (self.destination[0], self.destination[1])
|
||||||
|
|
||||||
def state_init(self):
|
def state_init(self):
|
||||||
self.append_write_buf("GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n" % (self.path, self.destination[0]))
|
self.append_write_buf(
|
||||||
print "Sending %ib" % (len(self.write_buf))
|
"GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n" % (
|
||||||
|
self.path, self.destination[0]))
|
||||||
|
print "Sending %ib" % (len(self.write_buf))
|
||||||
self.set_state("http_request_sent", 0)
|
self.set_state("http_request_sent", 0)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -72,15 +76,15 @@ if __name__ == "__main__":
|
||||||
for host in ("bitmessage.org",):
|
for host in ("bitmessage.org",):
|
||||||
direct = HttpConnection(host)
|
direct = HttpConnection(host)
|
||||||
while len(asyncore.socket_map) > 0:
|
while len(asyncore.socket_map) > 0:
|
||||||
# print "loop, state = %s" % (direct.state)
|
# print "loop, state = %s" % (direct.state)
|
||||||
asyncore.loop(timeout=1, count=1)
|
asyncore.loop(timeout=1, count=1)
|
||||||
|
|
||||||
proxy = Socks5HttpConnection(host)
|
proxy = Socks5HttpConnection(host)
|
||||||
while len(asyncore.socket_map) > 0:
|
while len(asyncore.socket_map) > 0:
|
||||||
# print "loop, state = %s" % (proxy.state)
|
# print "loop, state = %s" % (proxy.state)
|
||||||
asyncore.loop(timeout=1, count=1)
|
asyncore.loop(timeout=1, count=1)
|
||||||
|
|
||||||
proxy = Socks4aHttpConnection(host)
|
proxy = Socks4aHttpConnection(host)
|
||||||
while len(asyncore.socket_map) > 0:
|
while len(asyncore.socket_map) > 0:
|
||||||
# print "loop, state = %s" % (proxy.state)
|
# print "loop, state = %s" % (proxy.state)
|
||||||
asyncore.loop(timeout=1, count=1)
|
asyncore.loop(timeout=1, count=1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user