From e7324cf21853d1718aaaef6ca8c958fc05aa387b Mon Sep 17 00:00:00 2001 From: nishi Date: Fri, 9 Feb 2024 06:19:04 +0000 Subject: [PATCH] fix git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@195 d27a3e52-49c5-7645-884c-6793ebffc270 --- Python/__init__.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Python/__init__.py b/Python/__init__.py index e5a359d..d8f621e 100644 --- a/Python/__init__.py +++ b/Python/__init__.py @@ -31,6 +31,19 @@ libw3_loaded.W3_Set_Path.restype = None libw3_loaded.W3_On.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_void_p] libw3_loaded.W3_On.restype = None +libw3_loaded.W3_Set_Read_Size.argtypes = [ctypes.c_void_p, ctypes.c_int] +libw3_loaded.W3_Set_Read_Size.restype = None + +libw3_loaded.W3_Set_Header.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p] +libw3_loaded.W3_Set_Header.restype = None + +libw3_loaded.W3_Disconnect.argtypes = [ctypes.c_void_p] +libw3_loaded.W3_Disconnect.restype = None + +libw3_loaded.W3_Free.argtypes = [ctypes.c_void_p] +libw3_loaded.W3_Free.restype = None + + w3_list = [] @ctypes.CFUNCTYPE(None, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t) @@ -81,8 +94,18 @@ class w3: self._header_handler = handler def set_status_handler(self, handler): self._status_handler = handler + def set_read_size(self, size): + libw3_loaded.W3_Set_Read_Size(self._client, size) + def set_header(self, key, value): + libw3_loaded.W3_Set_Header(self._client, key.encode("utf-8"), value.encode("utf-8")) + def disconnect(self): + libw3_loaded.W3_Disconnect(self._client) def send_request(self): libw3_loaded.W3_Send_Request(self._client) + def destroy(self): + new_list = list(filter(lambda x: x._client != self._client, w3_list)) + w3_list = list() + libw3_loaded.W3_Free(self._client) class libw3: @staticmethod -- 2.43.0