lib: More contextification (#6343)

This commit is contained in:
Simon Frei
2020-02-24 21:57:15 +01:00
committed by GitHub
parent 7b8622c2e9
commit f0e33d052a
15 changed files with 138 additions and 42 deletions
+2 -1
View File
@@ -423,7 +423,7 @@ func replaceRawPath(u *url.URL, rp string) {
}
}
func soapRequest(url, service, function, message string) ([]byte, error) {
func soapRequest(ctx context.Context, url, service, function, message string) ([]byte, error) {
tpl := `<?xml version="1.0" ?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>%s</s:Body>
@@ -437,6 +437,7 @@ func soapRequest(url, service, function, message string) ([]byte, error) {
if err != nil {
return resp, err
}
req.Cancel = ctx.Done()
req.Close = true
req.Header.Set("Content-Type", `text/xml; charset="utf-8"`)
req.Header.Set("User-Agent", "syncthing/1.0")