Skip to content

Commit 61f9883

Browse files
authored
[test] Set listen_host when starting websockify.WebSocketProxy (#26681)
Without this change the websockify proxy tries to bind to the empty host ('::') is problematic from the security standpoint, and also causes issues no my corp machine.
1 parent 7c8bdb1 commit 61f9883

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/test_sockets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def __enter__(self):
9595
# source_is_ipv6=True here signals to websockify that it should prefer ipv6 address when
9696
# resolving host names. This matches what the node `ws` module does and means that `localhost`
9797
# resolves to `::1` on IPv6 systems.
98-
wsp = websockify.WebSocketProxy(verbose=True, source_is_ipv6=True, listen_port=self.listen_port, target_host="127.0.0.1", target_port=self.target_port, run_once=True)
98+
wsp = websockify.WebSocketProxy(verbose=True, source_is_ipv6=True, listen_host="127.0.0.1", listen_port=self.listen_port, target_host="127.0.0.1", target_port=self.target_port, run_once=True)
9999
self.websockify = multiprocessing.Process(target=wsp.start_server)
100100
self.websockify.start()
101101
self.processes.append(self.websockify)
@@ -145,7 +145,7 @@ def __enter__(self):
145145

146146
# compile the server
147147
suffix = '.mjs' if '-sEXPORT_ES6' in self.args else '.js'
148-
proc = run_process([EMCC, '-Werror', test_file(self.filename), '-o', 'server' + suffix, '-DSOCKK=%d' % self.listen_port] + self.args)
148+
proc = run_process([EMCC, '-Werror', test_file(self.filename), '-o', 'server' + suffix, f'-DSOCKK={self.listen_port}'] + self.args)
149149
print('Socket server build: out:', proc.stdout or '', '/ err:', proc.stderr or '')
150150

151151
self.process = Popen(config.NODE_JS + ['server' + suffix])

0 commit comments

Comments
 (0)