diff options
author | Jakob Borg <jakob@nym.se> | 2014-07-02 20:28:03 +0200 |
---|---|---|
committer | Jakob Borg <jakob@nym.se> | 2014-07-02 20:28:03 +0200 |
commit | 91c4ff6009a08900454aa5dd92767af421ae9e64 (patch) | |
tree | 06df82e8c216f74a0262d225cb8829909ea11e4a | |
parent | 0aa067a726cf7cdf46a021d8d55307d7f0bce831 (diff) |
Handle query parameters in UPnP control URL (fixes #211)
-rw-r--r-- | upnp/upnp.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/upnp/upnp.go b/upnp/upnp.go index b4afebad91..df9e73fd7c 100644 --- a/upnp/upnp.go +++ b/upnp/upnp.go @@ -203,12 +203,24 @@ func getServiceURL(rootURL string) (string, error) { } u, _ := url.Parse(rootURL) - if svc.ControlURL[0] == '/' { - 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 += svc.ControlURL + u.Path += p } - return u.String(), nil + u.RawQuery = q } func soapRequest(url, function, message string) error { |