Merge d235b24f21 into d58f8b5144
This commit is contained in:
commit
99c8ebeb0c
|
|
@ -109,6 +109,7 @@ Sec-WebSocket-Accept: %s\r
|
||||||
self.verbose = verbose
|
self.verbose = verbose
|
||||||
self.listen_host = listen_host
|
self.listen_host = listen_host
|
||||||
self.listen_port = listen_port
|
self.listen_port = listen_port
|
||||||
|
self.prefer_ipv6 = source_is_ipv6
|
||||||
self.ssl_only = ssl_only
|
self.ssl_only = ssl_only
|
||||||
self.daemon = daemon
|
self.daemon = daemon
|
||||||
self.run_once = run_once
|
self.run_once = run_once
|
||||||
|
|
@ -801,7 +802,7 @@ Sec-WebSocket-Accept: %s\r
|
||||||
is a WebSockets client then call new_client() method (which must
|
is a WebSockets client then call new_client() method (which must
|
||||||
be overridden) for each new client connection.
|
be overridden) for each new client connection.
|
||||||
"""
|
"""
|
||||||
lsock = self.socket(self.listen_host, self.listen_port)
|
lsock = self.socket(self.listen_host, self.listen_port, False, self.prefer_ipv6)
|
||||||
|
|
||||||
if self.daemon:
|
if self.daemon:
|
||||||
self.daemonize(keepfd=lsock.fileno(), chdir=self.web)
|
self.daemonize(keepfd=lsock.fileno(), chdir=self.web)
|
||||||
|
|
|
||||||
|
|
@ -242,6 +242,9 @@ def websockify_init():
|
||||||
choices=["exit", "ignore", "respawn"],
|
choices=["exit", "ignore", "respawn"],
|
||||||
help="action to take when the wrapped program exits "
|
help="action to take when the wrapped program exits "
|
||||||
"or daemonizes: exit (default), ignore, respawn")
|
"or daemonizes: exit (default), ignore, respawn")
|
||||||
|
parser.add_option("--prefer-ipv6", "-6",
|
||||||
|
action="store_true", dest="source_is_ipv6",
|
||||||
|
help="prefer IPv6 when resolving source_addr")
|
||||||
(opts, args) = parser.parse_args()
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
# Sanity checks
|
# Sanity checks
|
||||||
|
|
@ -260,6 +263,7 @@ def websockify_init():
|
||||||
# Parse host:port and convert ports to numbers
|
# Parse host:port and convert ports to numbers
|
||||||
if args[0].count(':') > 0:
|
if args[0].count(':') > 0:
|
||||||
opts.listen_host, opts.listen_port = args[0].rsplit(':', 1)
|
opts.listen_host, opts.listen_port = args[0].rsplit(':', 1)
|
||||||
|
opts.listen_host = opts.listen_host.strip('[]')
|
||||||
else:
|
else:
|
||||||
opts.listen_host, opts.listen_port = '', args[0]
|
opts.listen_host, opts.listen_port = '', args[0]
|
||||||
|
|
||||||
|
|
@ -272,6 +276,7 @@ def websockify_init():
|
||||||
else:
|
else:
|
||||||
if args[1].count(':') > 0:
|
if args[1].count(':') > 0:
|
||||||
opts.target_host, opts.target_port = args[1].rsplit(':', 1)
|
opts.target_host, opts.target_port = args[1].rsplit(':', 1)
|
||||||
|
opts.target_host = opts.target_host.strip('[]')
|
||||||
else:
|
else:
|
||||||
parser.error("Error parsing target")
|
parser.error("Error parsing target")
|
||||||
try: opts.target_port = int(opts.target_port)
|
try: opts.target_port = int(opts.target_port)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue