summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-09-27 18:07:53 +0200
committerwm4 <wm4@nowhere>2013-09-27 18:09:30 +0200
commitb7f01957ec37590a2143e45b377b8e6bb3bc36ed (patch)
treea9db70cd5906992170a4cd5798ec4bdd654518cf
parentb8382aabb338db49b1cc0344a7ec386fa7f7f1c2 (diff)
downloadmpv-b7f01957ec37590a2143e45b377b8e6bb3bc36ed.tar.bz2
mpv-b7f01957ec37590a2143e45b377b8e6bb3bc36ed.tar.xz
network: add options to control TLS verification
-rw-r--r--DOCS/man/en/options.rst8
-rw-r--r--mpvcore/options.c4
-rw-r--r--mpvcore/options.h2
-rw-r--r--stream/stream_lavf.c3
4 files changed, 17 insertions, 0 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 2eac6ddee5..9230529d54 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -2283,6 +2283,14 @@
is often a slow operation, and if the title changes every frame,
playback can be ruined.
+``--tls-ca-file=<filename>``
+ Certificate authority database file for use with TLS. (Silently fails with
+ older ffmpeg or libav versions.)
+
+``--tls-verify``
+ Verify peer certificates when using TLS (e.g. with ``https://...``).
+ (Silently fails with older ffmpeg or libav versions.)
+
``--tv=<option1:option2:...>``
This option tunes various properties of the TV capture module. For
watching TV with mpv, use ``tv://`` or ``tv://<channel_number>`` or
diff --git a/mpvcore/options.c b/mpvcore/options.c
index 9cffb07284..234d8646bd 100644
--- a/mpvcore/options.c
+++ b/mpvcore/options.c
@@ -47,6 +47,8 @@ int network_cookies_enabled = 0;
char *network_useragent="mpv " VERSION;
char *network_referrer=NULL;
char **network_http_header_fields=NULL;
+int network_tls_verify;
+char *network_tls_ca_file;
extern char *lirc_configfile;
@@ -388,6 +390,8 @@ const m_option_t mp_opts[] = {
{"udp", 1},
{"tcp", 2},
{"http", 3})),
+ {"tls-verify", &network_tls_verify, CONF_TYPE_FLAG, 0, 0, 0, NULL},
+ {"tls-ca-file", &network_tls_ca_file, CONF_TYPE_STRING, 0, 0, 0, NULL},
// ------------------------- demuxer options --------------------
diff --git a/mpvcore/options.h b/mpvcore/options.h
index 025ff63b5d..fb88456ac9 100644
--- a/mpvcore/options.h
+++ b/mpvcore/options.h
@@ -281,6 +281,8 @@ extern char **network_http_header_fields;
extern char *network_useragent;
extern char *network_referrer;
extern int network_cookies_enabled;
+extern int network_tls_verify;
+extern char *network_tls_ca_file;
extern char *cookies_file;
extern const m_option_t mp_opts[];
diff --git a/stream/stream_lavf.c b/stream/stream_lavf.c
index 545a8dfc5c..c7161b506c 100644
--- a/stream/stream_lavf.c
+++ b/stream/stream_lavf.c
@@ -179,6 +179,9 @@ static int open_f(stream_t *stream, int mode)
av_dict_set(&dict, "user-agent", network_useragent, 0);
if (network_cookies_enabled)
av_dict_set(&dict, "cookies", talloc_steal(temp, cookies_lavf()), 0);
+ av_dict_set(&dict, "tls_verify", network_tls_verify ? "1" : "0", 0);
+ if (network_tls_ca_file)
+ av_dict_set(&dict, "ca_file", network_tls_ca_file, 0);
char *cust_headers = talloc_strdup(temp, "");
if (network_referrer) {
cust_headers = talloc_asprintf_append(cust_headers, "Referer: %s\r\n",