mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
Handle query parameters in UPnP control URL (fixes #211)
This commit is contained in:
parent
0aa067a726
commit
91c4ff6009
22
upnp/upnp.go
22
upnp/upnp.go
@ -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/">
|
||||||
|
Loading…
Reference in New Issue
Block a user