From 2fd12a839c1f0f8ba585877568ccd0e93f747eda Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 18 Jun 2024 12:01:21 +0200 Subject: [PATCH] more windows2000 support --- copyparty/httpsrv.py | 6 +++--- copyparty/util.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/copyparty/httpsrv.py b/copyparty/httpsrv.py index c0e69ee5..0350de44 100644 --- a/copyparty/httpsrv.py +++ b/copyparty/httpsrv.py @@ -12,7 +12,7 @@ import time import queue -from .__init__ import ANYWIN, CORES, EXE, MACOS, TYPE_CHECKING, EnvParams +from .__init__ import ANYWIN, CORES, EXE, MACOS, TYPE_CHECKING, EnvParams, unicode try: MNFE = ModuleNotFoundError @@ -335,11 +335,11 @@ class HttpSrv(object): try: sck, saddr = srv_sck.accept() - cip, cport = saddr[:2] + cip = unicode(saddr[0]) if cip.startswith("::ffff:"): cip = cip[7:] - addr = (cip, cport) + addr = (cip, saddr[1]) except (OSError, socket.error) as ex: if self.stopping: break diff --git a/copyparty/util.py b/copyparty/util.py index 14a0bf1c..1b2269fe 100644 --- a/copyparty/util.py +++ b/copyparty/util.py @@ -162,6 +162,7 @@ try: socket.inet_pton(socket.AF_INET6, "::1") HAVE_IPV6 = True except: + def inet_pton(fam, ip): return socket.inet_aton(ip)