From 3c90672b2f45a9d25639f87c40e4e37f4ff6a104 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 21 Nov 2008 18:23:44 +0000 Subject: [PATCH] fixed upnp parsing problem #427 --- src/upnp.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/upnp.cpp b/src/upnp.cpp index 85941c7e7..6132801b1 100644 --- a/src/upnp.cpp +++ b/src/upnp.cpp @@ -875,8 +875,16 @@ void upnp::on_upnp_xml(error_code const& e } } - if (s.url_base.empty()) d.control_url = s.control_url; - else d.control_url = s.url_base + s.control_url; + if (!s.url_base.empty()) + { + // avoid double slashes in path + if (s.url_base[s.url_base.size()-1] == '/' + && !s.control_url.empty() + && s.control_url[0] == '/') + s.url_base.erase(s.url_base.end()-1); + d.control_url = s.url_base + s.control_url; + } + else d.control_url = s.control_url; std::string protocol; std::string auth;