aboutsummaryrefslogtreecommitdiff
path: root/cli/onionshare_cli/meek.py
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2021-11-07 12:12:12 -0800
committerMicah Lee <micah@micahflee.com>2021-11-07 12:12:12 -0800
commit9430439b5f02829e3677ac187e1db7a52076ddad (patch)
tree36208e4077b23bccc379272ed2c2ef93a04b6ec1 /cli/onionshare_cli/meek.py
parent472e383b7d0f4040e4963ffff95da1e86fe85cca (diff)
downloadonionshare-9430439b5f02829e3677ac187e1db7a52076ddad.tar.gz
onionshare-9430439b5f02829e3677ac187e1db7a52076ddad.zip
Fix meek-client in Windows
Diffstat (limited to 'cli/onionshare_cli/meek.py')
-rw-r--r--cli/onionshare_cli/meek.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/cli/onionshare_cli/meek.py b/cli/onionshare_cli/meek.py
index b2e70dc1..c5df7b7f 100644
--- a/cli/onionshare_cli/meek.py
+++ b/cli/onionshare_cli/meek.py
@@ -85,6 +85,10 @@ class Meek(object):
self.common.log("Meek", "start", "Starting meek client")
if self.common.platform == "Windows":
+ env = os.environ.copy()
+ for key in self.meek_env:
+ env[key] = self.meek_env[key]
+
# In Windows, hide console window when opening meek-client.exe subprocess
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
@@ -100,7 +104,7 @@ class Meek(object):
stderr=subprocess.PIPE,
startupinfo=startupinfo,
bufsize=1,
- env=self.meek_env,
+ env=env,
text=True,
)
else:
@@ -129,6 +133,7 @@ class Meek(object):
# read stdout without blocking
try:
line = q.get_nowait()
+ self.common.log("Meek", "start", line.strip())
except Empty:
# no stdout yet?
pass
@@ -143,6 +148,10 @@ class Meek(object):
)
break
+ if "CMETHOD-ERROR" in line:
+ self.cleanup()
+ raise MeekNotRunning()
+
if self.meek_port:
self.meek_proxies = {
"http": f"socks5h://{self.meek_host}:{self.meek_port}",
@@ -150,6 +159,7 @@ class Meek(object):
}
else:
self.common.log("Meek", "start", "Could not obtain the meek port")
+ self.cleanup()
raise MeekNotRunning()
def cleanup(self):