summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-07-02 20:28:03 +0200
committerJakob Borg <jakob@nym.se>2014-07-02 20:28:03 +0200
commit91c4ff6009a08900454aa5dd92767af421ae9e64 (patch)
tree06df82e8c216f74a0262d225cb8829909ea11e4a
parent0aa067a726cf7cdf46a021d8d55307d7f0bce831 (diff)
Handle query parameters in UPnP control URL (fixes #211)
-rw-r--r--upnp/upnp.go20
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 {