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

View File

@ -203,14 +203,26 @@ func getServiceURL(rootURL string) (string, error) {
} }
u, _ := url.Parse(rootURL) u, _ := url.Parse(rootURL)
if svc.ControlURL[0] == '/' { replaceRawPath(u, svc.ControlURL)
u.Path = svc.ControlURL
} else {
u.Path += svc.ControlURL
}
return u.String(), nil 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 { func soapRequest(url, function, message string) error {
tpl := `<?xml version="1.0" ?> tpl := `<?xml version="1.0" ?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">