diff options
author | ulion <ulion2002@gmail.com> | 2013-04-01 03:47:38 -0700 |
---|---|---|
committer | ulion <ulion2002@gmail.com> | 2013-04-01 03:47:38 -0700 |
commit | 0482c221315607f81fc077814e0eb4855f200aa7 (patch) | |
tree | a0a0af60c0b3fc865a3354261dedcdec2ea21149 | |
parent | 42bc24826e797c43c6624806cfa569a630377ced (diff) | |
parent | d22dffd4a9da5527d9d8dad2874e9f6286b4a668 (diff) |
Merge pull request #2401 from ulion/ftp_switch_to_protocol_options
Ftp switch from url options to protocol options
-rw-r--r-- | xbmc/URL.cpp | 2 | ||||
-rw-r--r-- | xbmc/filesystem/CurlFile.cpp | 63 |
2 files changed, 21 insertions, 44 deletions
diff --git a/xbmc/URL.cpp b/xbmc/URL.cpp index c629995b95..f0d81b4ebe 100644 --- a/xbmc/URL.cpp +++ b/xbmc/URL.cpp @@ -195,7 +195,7 @@ void CURL::Parse(const CStdString& strURL1) sep = "?;#|"; else if(strProtocol2.Equals("ftp") || strProtocol2.Equals("ftps")) - sep = "?;"; + sep = "?;|"; if(sep) { diff --git a/xbmc/filesystem/CurlFile.cpp b/xbmc/filesystem/CurlFile.cpp index 1d8c1a3f00..bc386f50cf 100644 --- a/xbmc/filesystem/CurlFile.cpp +++ b/xbmc/filesystem/CurlFile.cpp @@ -660,6 +660,15 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2) if( strProtocol.Equals("ftp") || strProtocol.Equals("ftps") ) { + // we was using url optons for urls, keep the old code work and warning + if (!url2.GetOptions().IsEmpty()) + { + CLog::Log(LOGWARNING, "%s: ftp url option is deprecated, please switch to use protocol option (change '?' to '|'), url: [%s]", __FUNCTION__, url2.Get().c_str()); + url2.SetProtocolOptions(url2.GetOptions().Mid(1)); + /* ftp has no options */ + url2.SetOptions(""); + } + /* this is uggly, depending on from where */ /* we get the link it may or may not be */ /* url encoded. if handed from ftpdirectory */ @@ -690,53 +699,21 @@ void CCurlFile::ParseAndCorrectUrl(CURL &url2) url2.SetFileName(filename); - CStdString options = url2.GetOptions().Mid(1); - options.TrimRight('/'); // hack for trailing slashes being added from source - m_ftpauth = ""; + if (url2.HasProtocolOption("auth")) + { + m_ftpauth = url2.GetProtocolOption("auth"); + if(m_ftpauth.IsEmpty()) + m_ftpauth = "any"; + } m_ftpport = ""; - m_ftppasvip = false; - - /* parse options given */ - CUtil::Tokenize(options, array, "&"); - for(CStdStringArray::iterator it = array.begin(); it != array.end(); it++) + if (url2.HasProtocolOption("active")) { - CStdString name, value; - int pos = it->Find('='); - if(pos >= 0) - { - name = it->Left(pos); - value = it->Mid(pos+1, it->size()); - } - else - { - name = (*it); - value = ""; - } - - if(name.Equals("auth")) - { - m_ftpauth = value; - if(m_ftpauth.IsEmpty()) - m_ftpauth = "any"; - } - else if(name.Equals("active")) - { - m_ftpport = value; - if(value.IsEmpty()) - m_ftpport = "-"; - } - else if(name.Equals("pasvip")) - { - if(value == "0") - m_ftppasvip = false; - else - m_ftppasvip = true; - } + m_ftpport = url2.GetProtocolOption("active"); + if(m_ftpport.IsEmpty()) + m_ftpport = "-"; } - - /* ftp has no options */ - url2.SetOptions(""); + m_ftppasvip = url2.HasProtocolOption("pasvip") && url2.GetProtocolOption("pasvip") != "0"; } else if( strProtocol.Equals("http") || strProtocol.Equals("https")) |