From 7470b02ef4cd7a2eb2e0d13971d003067fd99025 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Fri, 21 Sep 2012 02:30:24 +0300 Subject: options: fix URL user/password parsing Code parsing the optional user/password part for some URL types given as files to play, such as "ftp://user:password@host/filename", was broken. Fix. I guess this isn't used much as nobody reported it earlier. --- m_option.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m_option.c b/m_option.c index d48d4016b8..2ad80f6eef 100644 --- a/m_option.c +++ b/m_option.c @@ -1979,6 +1979,8 @@ static int parse_custom_url(const m_option_t *opt, struct bstr name, struct bstr path = bstr_cut(ptr1, idx); idx = bstrchr(hostpart, '@'); if (idx >= 0) { + struct bstr userpass = bstr_splice(hostpart, 0, idx); + hostpart = bstr_cut(hostpart, idx + 1); // We got something, at least a username... if (!m_option_list_find(desc->fields, "username")) { mp_msg(MSGT_CFGPARSER, MSGL_WARN, @@ -1986,7 +1988,6 @@ static int parse_custom_url(const m_option_t *opt, struct bstr name, BSTR_P(name)); // skip } else { - struct bstr userpass = bstr_splice(hostpart, 0, idx); idx = bstrchr(userpass, ':'); if (idx >= 0) { // We also have a password @@ -2026,7 +2027,6 @@ static int parse_custom_url(const m_option_t *opt, struct bstr name, } } } - hostpart = bstr_cut(hostpart, idx + 1); } // Before looking for a port number check if we have an IPv6 type -- cgit v1.2.3