def __init__(self, raise_event, on_disconnect, idlequeue, estabilish_tls, certs, xmpp_server, domain, bosh_dict, proxy_creds): NonBlockingTransport.__init__(self, raise_event, on_disconnect, idlequeue, estabilish_tls, certs) self.bosh_sid = None if locale.getdefaultlocale()[0]: self.bosh_xml_lang = locale.getdefaultlocale()[0].split('_')[0] else: self.bosh_xml_lang = 'en' self.http_version = 'HTTP/1.1' self.http_persistent = True self.http_pipelining = bosh_dict['bosh_http_pipelining'] self.bosh_to = domain self.route_host, self.route_port = xmpp_server self.bosh_wait = bosh_dict['bosh_wait'] if not self.http_pipelining: self.bosh_hold = 1 else: self.bosh_hold = bosh_dict['bosh_hold'] self.bosh_requests = self.bosh_hold self.bosh_uri = bosh_dict['bosh_uri'] self.bosh_content = bosh_dict['bosh_content'] self.over_proxy = bosh_dict['bosh_useproxy'] if estabilish_tls: self.bosh_secure = 'true' else: self.bosh_secure = 'false' self.use_proxy_auth = bosh_dict['useauth'] self.proxy_creds = proxy_creds self.wait_cb_time = None self.http_socks = [] self.stanza_buffer = [] self.prio_bosh_stanzas = [] self.current_recv_handler = None self.current_recv_socket = None self.key_stack = None self.ack_checker = None self.after_init = False self.proxy_dict = {} if self.over_proxy and self.estabilish_tls: self.proxy_dict['type'] = 'http' # with SSL over proxy, we do HTTP CONNECT to proxy to open a channel to # BOSH Connection Manager host, port = urisplit(self.bosh_uri)[1:3] self.proxy_dict['xmpp_server'] = (host, port) self.proxy_dict['credentials'] = self.proxy_creds