From 33bf82c75fe701ed636b952e9f2b726ff8a11a30 Mon Sep 17 00:00:00 2001 From: callebtc <93376500+callebtc@users.noreply.github.com> Date: Thu, 18 Jul 2024 10:46:55 +0200 Subject: [PATCH] wip: httpx add host header and disable verify --- cashu/wallet/v1_api.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cashu/wallet/v1_api.py b/cashu/wallet/v1_api.py index d5d9ce50..379826d0 100644 --- a/cashu/wallet/v1_api.py +++ b/cashu/wallet/v1_api.py @@ -61,21 +61,26 @@ async def wrapper(self, *args, **kwargs): # set proxy proxies_dict = {} proxy_url: Union[str, None] = None + headers_dict = {"Client-version": settings.version} if settings.tor and TorProxy().check_platform(): self.tor = TorProxy(timeout=True) self.tor.run_daemon(verbose=True) proxy_url = "socks5://localhost:9050" elif settings.socks_proxy: proxy_url = f"socks5://{settings.socks_proxy}" + headers_dict["Host"] = ( + self.url.replace("https://", "") + .replace("http://", "") + .replace("/", "") + .replace(".", "") + ) elif settings.http_proxy: proxy_url = settings.http_proxy if proxy_url: proxies_dict.update({"all://": proxy_url}) - headers_dict = {"Client-version": settings.version} - self.httpx = httpx.AsyncClient( - verify=not settings.debug, + verify=False, proxies=proxies_dict, # type: ignore headers=headers_dict, base_url=self.url,