support for UPnP routers that don't provide a urlbase

This commit is contained in:
Arvid Norberg 2008-10-29 01:17:19 +00:00
parent ce9d9c760c
commit 972450e766
1 changed files with 13 additions and 5 deletions

View File

@ -853,14 +853,22 @@ 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;
std::stringstream msg;
msg << "found control URL: " << s.control_url << " namespace: "
<< d.service_namespace << " in response from " << d.url;
log(msg.str());
std::string protocol;
std::string auth;
char const* error;
if (!d.control_url.empty() && d.control_url[0] == '/')
{
boost::tie(protocol, auth, d.hostname, d.port, d.path, error)
= parse_url_components(d.url);
d.control_url = protocol + "://" + d.hostname + ":"
+ boost::lexical_cast<std::string>(d.port) + s.control_url;
}
std::stringstream msg;
msg << "found control URL: " << d.control_url << " namespace: "
<< d.service_namespace << " urlbase: " << s.url_base << " in response from " << d.url;
log(msg.str());
boost::tie(protocol, auth, d.hostname, d.port, d.path, error)
= parse_url_components(d.control_url);