Skip to content

Commit 474325f

Browse files
authored
cli.main: use *_args, **_kwargs for create_http_server (#3450)
use `127.0.0.1` for local `create_http_server()` use `0.0.0.0` for external `create_http_server()` `--player-http` = ***127.0.0.1*** https://streamlink.github.io/cli.html#cmdoption-player-http `--player-continuous-http` = ***127.0.0.1*** https://streamlink.github.io/cli.html#cmdoption-player-continuous-http `--player-external-http` = ***None*** / ***0.0.0.0*** https://streamlink.github.io/cli.html#cmdoption-player-external-http --- we use `AF_INET` which is IPv4 https://github.com/streamlink/streamlink/blob/2.0.0/src/streamlink_cli/utils/http_server.py#L24 we don't use `AF_INET6` which is IPv6, so IPv6 support is unimportant. Ref #2622 (comment) --- ``` $ streamlink https://www.youtube.com/channel/UCSrZ3UV4jOidv8ppoVuvW9Q/live --player-http -l debug ... [cli][info] Starting player: /usr/bin/mpv [cli.output][debug] Opening subprocess: /usr/bin/mpv "--force-media-title=Euronews English Live" http://127.0.0.1:35085/ ``` ``` $ streamlink https://www.youtube.com/channel/UCSrZ3UV4jOidv8ppoVuvW9Q/live --player-continuous-http -l debug ... [cli][info] Starting player: /usr/bin/mpv [cli.output][debug] Opening subprocess: /usr/bin/mpv "--force-media-title=Euronews English Live" http://127.0.0.1:39099/ [cli][info] Got HTTP request from libmpv ``` ``` $ streamlink https://www.youtube.com/channel/UCSrZ3UV4jOidv8ppoVuvW9Q/live --player-external-http --player-external-http-port 33333 [cli][info] Starting server, access with one of: [cli][info] http://127.0.0.1:33333/ [cli][info] http://127.0.0.53:33333/ [cli][info] http://127.0.1.1:33333/ [cli][info] Got HTTP request from Mozilla/5.0 ... [cli][info] Opening stream: 720p (hls) ```
1 parent 374130a commit 474325f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/streamlink_cli/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def create_output(plugin):
122122
return out
123123

124124

125-
def create_http_server(host=None, port=0):
125+
def create_http_server(*_args, **_kwargs):
126126
"""Creates a HTTP server listening on a given host and port.
127127
128128
If host is empty, listen on all available interfaces, and if port is 0,
@@ -131,7 +131,7 @@ def create_http_server(host=None, port=0):
131131

132132
try:
133133
http = HTTPServer()
134-
http.bind(host=host, port=port)
134+
http.bind(*_args, **_kwargs)
135135
except OSError as err:
136136
console.exit("Failed to create HTTP server: {0}", err)
137137

0 commit comments

Comments
 (0)