Handle query parameters in UPnP control URL (fixes #211)

This commit is contained in:
Jakob Borg 2014-07-02 20:28:03 +02:00
parent 0aa067a726
commit 91c4ff6009
1 changed files with 17 additions and 5 deletions

View File

@ -203,14 +203,26 @@ func getServiceURL(rootURL string) (string, error) {
}
u, _ := url.Parse(rootURL)
if svc.ControlURL[0] == '/' {
u.Path = svc.ControlURL
} else {
u.Path += svc.ControlURL
}
replaceRawPath(u, svc.ControlURL)
return u.String(), nil
}
func replaceRawPath(u *url.URL, rp string) {
var p, q string
fs := strings.Split(rp, "?")
p = fs[0]
if len(fs) > 1 {
q = fs[1]
}
if p[0] == '/' {
u.Path = p
} else {
u.Path += p
}
u.RawQuery = q
}
func soapRequest(url, function, message string) error {
tpl := `<?xml version="1.0" ?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">