How to use the aquests.client.asynconnect.AsynSSLConnect function in aquests

To help you get started, we’ve selected a few aquests examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hansroh / aquests / aquests / __init__.py View on Github external
_logger = logger

	if qrandom:
		_que = queue.RandomQueue ()
	else:
		_que = queue.Queue ()

	_allow_redirects = allow_redirects
	_force_h1 = request_handler.RequestHandler.FORCE_HTTP_11 = force_http1

	if not use_pool:
		asynconnect.AsynConnect.keep_connect = use_pool
		asynconnect.AsynSSLConnect.keep_connect = use_pool
	if not _force_h1:
		asynconnect.AsynConnect.fifo_class = await_fifo
		asynconnect.AsynSSLConnect.fifo_class = await_fifo

	http2.MAX_HTTP2_CONCURRENT_STREAMS = http2_constreams
	_workers = workers
	_concurrent = workers

	if not force_http1:
		_concurrent = workers * http2_constreams
	elif http2_constreams:
		pass
		#_logger ("parameter http2_constreams is ignored", "warn")

	if callback:
		_cb_gateway = callback

	if cookie:
		ls.create (_logger)
github hansroh / aquests / aquests / client / asynconnect.py View on Github external
numsent = self.socket.send (data)	
			if numsent:
				self.set_event_time ()
			return numsent	

		except ssl.SSLError as why:
			if why.errno == ssl.SSL_ERROR_WANT_WRITE:
				return 0
			elif why.errno == ssl.SSL_ERROR_ZERO_RETURN:				
				self.handle_close (700, "Connection closed by SSL_ERROR_ZERO_RETURN")
				return 0
			else:
				raise


class AsynSSLProxyConnect (AsynSSLConnect, AsynConnect):
	is_ssl = True

	def __init__ (self, address, lock = None, logger = None):
		AsynConnect.__init__ (self, address, lock, logger)

	def handle_connect_event (self):
		if self.established:
			AsynSSLConnect.handle_connect_event (self)
		else:	
			AsynConnect.handle_connect_event (self)
	
	def recv (self, buffer_size):		
		if self._handshaked or self._handshaking:
			return AsynSSLConnect.recv (self, buffer_size)				
		else:
			return AsynConnect.recv (self, buffer_size)
github hansroh / aquests / aquests / client / __init__.py View on Github external
def set_timeout (timeout):
	for each in (asynconnect.AsynConnect, asynconnect.AsynSSLConnect, asynconnect.AsynSSLProxyConnect):
		each.keep_alive = timeout
		each.zombie_timeout = timeout
github hansroh / aquests / aquests / protocols / http / request_handler.py View on Github external
self.wrap_in_chunk = False
		self.end_of_data = False
		self.expect_disconnect = False
		
		self.request = request
		self.callback = callback		
		self.connection = connection				
		
		self.retry_count = 0
		self.http2_handler = None
		
		self.buffer = b""	
		self.response = None
		self.callbacked = 0
		
		self._ssl = isinstance (self.asyncon, asynconnect.AsynSSLConnect)			
		self.method, self.uri = (
			self.request.get_method (),			
			self.asyncon.is_proxy () and self.request.uri or self.request.path
		)
		self.header = []
		if request.get_address () is None:
			request.set_address (self.asyncon.address)
github hansroh / aquests / aquests / client / socketpool.py View on Github external
def create_asyncon (self, server, scheme):		
		if scheme in ("https", "wss"):
			__conn_class = asynconnect.AsynSSLConnect
			__dft_Port = 443
		elif scheme == "tunnel":
			__conn_class = asynconnect.AsynConnect
			__dft_Port = 443
		elif scheme == "proxy":
			__conn_class = asynconnect.AsynConnect			
			__dft_Port = 5000
		elif scheme == "proxys":
			__conn_class = asynconnect.AsynSSLProxyConnect
			__dft_Port = 5000				
		else:
			__conn_class = asynconnect.AsynConnect
			__dft_Port = 80

		if self.use_syn_connection:
			if scheme == "https":
github hansroh / aquests / aquests / __init__.py View on Github external
if logger is None:
		logger = logger_f.screen_logger ()
	_logger = logger

	if qrandom:
		_que = queue.RandomQueue ()
	else:
		_que = queue.Queue ()

	_allow_redirects = allow_redirects
	_force_h1 = request_handler.RequestHandler.FORCE_HTTP_11 = force_http1

	if not use_pool:
		asynconnect.AsynConnect.keep_connect = use_pool
		asynconnect.AsynSSLConnect.keep_connect = use_pool
	if not _force_h1:
		asynconnect.AsynConnect.fifo_class = await_fifo
		asynconnect.AsynSSLConnect.fifo_class = await_fifo

	http2.MAX_HTTP2_CONCURRENT_STREAMS = http2_constreams
	_workers = workers
	_concurrent = workers

	if not force_http1:
		_concurrent = workers * http2_constreams
	elif http2_constreams:
		pass
		#_logger ("parameter http2_constreams is ignored", "warn")

	if callback:
		_cb_gateway = callback
github hansroh / aquests / aquests / client / asynconnect.py View on Github external
def send (self, data):	
		if self._handshaked or self._handshaking:
			return AsynSSLConnect.send (self, data)
		else:
			return AsynConnect.send (self, data)
github hansroh / aquests / aquests / client / asynconnect.py View on Github external
def handle_connect_event (self):
		if self.established:
			AsynSSLConnect.handle_connect_event (self)
		else:	
			AsynConnect.handle_connect_event (self)
github hansroh / aquests / aquests / client / asynconnect.py View on Github external
def recv (self, buffer_size):		
		if self._handshaked or self._handshaking:
			return AsynSSLConnect.recv (self, buffer_size)				
		else:
			return AsynConnect.recv (self, buffer_size)