Merge pull request #1708 from jarlebring/upnp_close_conn_fix

Fix to for routers that cannot handle many open HTTP-connections
This commit is contained in:
Jakob Borg 2015-04-26 22:54:47 +02:00
commit fd4ea46fd7

View File

@ -452,6 +452,7 @@ func soapRequest(url, service, function, message string) ([]byte, error) {
if err != nil {
return resp, err
}
req.Close = true
req.Header.Set("Content-Type", `text/xml; charset="utf-8"`)
req.Header.Set("User-Agent", "syncthing/1.0")
req.Header["SOAPAction"] = []string{fmt.Sprintf(`"%s#%s"`, service, function)} // Enforce capitalization in header-entry for sensitive routers. See issue #1696
@ -467,6 +468,9 @@ func soapRequest(url, service, function, message string) ([]byte, error) {
r, err := http.DefaultClient.Do(req)
if err != nil {
if debug {
l.Debugln(err)
}
return resp, err
}