def __init__(self, client, proxy_infos): assert(proxy_infos.type in ('http', 'https')), "HTTPConnectProxy expects an http(s) proxy description" assert(client.domain == AF_INET), "HTTP CONNECT only handles INET address family" assert(client.type == SOCK_STREAM), "HTTP CONNECT only handles SOCK_STREAM" assert(client.status == IoStatus.CLOSED), "HTTPConnectProxy expects a closed client" AbstractProxy.__init__(self, client, proxy_infos) self._transport = TCPClient(self._proxy.host, self._proxy.port) self._transport.connect("notify::status", self._on_transport_status) self._transport.connect("error", self._on_transport_error) self._http_parser = HTTPParser(self._transport) self._http_parser.connect("received", self._on_proxy_response)
def __init__(self, client, proxy_infos): assert (proxy_infos.type in ( 'http', 'https')), "HTTPConnectProxy expects an http(s) proxy description" assert (client.domain == AF_INET ), "HTTP CONNECT only handles INET address family" assert (client.type == SOCK_STREAM ), "HTTP CONNECT only handles SOCK_STREAM" assert (client.status == IoStatus.CLOSED ), "HTTPConnectProxy expects a closed client" AbstractProxy.__init__(self, client, proxy_infos) self._transport = TCPClient(self._proxy.host, self._proxy.port) self._transport.connect("notify::status", self._on_transport_status) self._transport.connect("error", self._on_transport_error) self._http_parser = HTTPParser(self._transport) self._http_parser.connect("received", self._on_proxy_response)
def __init__(self, client, proxy_infos): assert(proxy_infos.type == 'socks4'), \ "SOCKS4Proxy expects a socks4 proxy description" # TODO : implement version 4a of the protocol to allow proxy-side name resolution assert(client.domain == AF_INET), \ "SOCKS4 CONNECT only handles INET address family" assert(client.type == SOCK_STREAM), \ "SOCKS4 CONNECT only handles SOCK_STREAM" assert(client.status == IoStatus.CLOSED), \ "SOCKS4Proxy expects a closed client" AbstractProxy.__init__(self, client, proxy_infos) self._transport = TCPClient(self._proxy.host, self._proxy.port) self._transport.connect("notify::status", self._on_transport_status) self._transport.connect("error", self._on_transport_error) self._delimiter_parser = DelimiterParser(self._transport) self._delimiter_parser.delimiter = 8 self._delimiter_parser.connect("received", self._on_proxy_response)
def __init__(self, client, proxy): assert(proxy.type in ('socks', 'socks5')), \ "SOCKS5Proxy expects a socks5 proxy description" assert(client.domain == AF_INET), \ "SOCKS5 CONNECT only handles INET address family" assert(client.type == SOCK_STREAM), \ "SOCKS5 CONNECT only handles SOCK_STREAM" assert(client.status == IoStatus.CLOSED), \ "SOCKS5Proxy expects a closed client" AbstractProxy.__init__(self, client, proxy) self._transport = TCPClient(self._proxy.host, self._proxy.port) self._transport.connect("notify::status", self._on_transport_status) self._transport.connect("error", self._on_transport_error) self._delimiter_parser = DelimiterParser(self._transport) self._delimiter_parser.connect("received", self._on_proxy_response) self._state = None self._must_auth = False